Hello!
Everything works ok. 0 errors in Chrome or in tests console. But I get this error. And all pipeline is broken.
If there is a error, why it is hidden from me?
Uncaught Error: Script error.
Cypress detected that an uncaught error was thrown from a cross origin script.
We cannot provide you the stack trace, line number, or file where this error occurred.
Check your Developer Tools Console for the actual error - it should be printed there.
It's possible to enable debugging these scripts by adding the 'crossorigin' attribute and setting a CORS header.
https://on.cypress.io/cross-origin-script-error
This error originated from your application code, not from Cypress.
When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
This behavior is configurable, and you can choose to turn this off by listening to the 'uncaught:exception' event.
https://on.cypress.io/uncaught-exception-from-application
Unfortunately we'll have to close this issue if no reproducible example is provided. Can anyone provide a way to reproduce this?
You may also try to update to version 3.1.2 as we just fixed some cross origin error issues.
The Uncaught Error: Script error issue happens every time for https://harper-morpho-luna.myshopify.com, while I have used cy.visit('https://harper-morpho-luna.myshopify.com')
@hiren0007 I'm not totally sure why this is displaying as a 'cross origin error'. It looks like there is an error in Harpers own code trying to console.log() an undefined variable when the window loads. Perhaps I'm wrong about it not being from a cross origin script though 馃
If this is not your website and you cannot fix the error, I suggest adding a check to ignore uncaught errors in Cypress like below:
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
it('fails to visit website 1', function () {
cy.visit('https://harper-morpho-luna.myshopify.com')
})
@hiren0007 I'm not totally sure why this is displaying as a 'cross origin error'. It looks like there is an error in Harpers own code trying to console.log() an undefined variable when the window loads. Perhaps I'm wrong about it not being from a cross origin script though
If this is not your website and you cannot fix the error, I suggest adding a check to ignore uncaught errors in Cypress like below:
Cypress.on('uncaught:exception', (err, runnable) => { // returning false here prevents Cypress from // failing the test return false }) it('fails to visit website 1', function () { cy.visit('https://harper-morpho-luna.myshopify.com') })
Thanks Jennifer.
It really worked. (bypassed uncaught exception).
Unfortunately we'll have to close this issue if no reproducible example is provided. Can anyone provide a way to reproduce this?
You may also try to update to version 3.1.2 as we just fixed some cross origin error issues.
@jennifer-shehane I am experiencing this issue exactly the way it was describe initially. I can reproduce it fairly stably.
Is there a solution for this?
Thank you
fwiw, in my case the error was that I used Promise.prototype.finally
, which is supported in chrome 73, but not in electron 59.
Hello.
Interestingly, this workaround (bypassing uncaught errors) work in the open
ui, but still fail in terminal/cli! And when I simply return false
for that listener, it locks hanging the terminal, never ending the tests.
Any reason for that?!
My issue is that I've added a new script
tag that points to a different subdomain. I have a link
tag that also points to a different subdomain, but Cypress is fine with that. Maybe this is a reproducible case?
If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.
Most helpful comment
@hiren0007 I'm not totally sure why this is displaying as a 'cross origin error'. It looks like there is an error in Harpers own code trying to console.log() an undefined variable when the window loads. Perhaps I'm wrong about it not being from a cross origin script though 馃
If this is not your website and you cannot fix the error, I suggest adding a check to ignore uncaught errors in Cypress like below: