-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in cypress_runner.js is reported as "error originated from your application code, not from Cypress" #7594
Comments
@rhassingerr We'll need some test code that we can run exactly to see the error you are encountering. Can you provide the code with the Can you downgrade to 3.5.0 and show the behavior in that version of Cypress also? Without this we'll have to close this issue as there is not enough information to reproduce the problem. This does not mean that your issue is not happening - it just means that we do not have a path to move forward. Please comment in this issue with a reproducible example and we will consider reopening the issue. |
I have the same problem, this new annoying error... I didnt have time to manage my tests for last 2 months or so and i come back to this.. Im trying to find the problem now. At the moment i think that it happens when it wants to do many things at the same time before loading finishes. But this wasnt happening before, now i have it in most of my tests |
@jennifer-shehane I made simplest one i can. Hope its enough for analysis and that its the same problem as @rhassingerr has. context('Test', () => {
beforeEach(() => {
cy.visit('https://dev.commanderservices.eu/')
});
//Login//
it('.type() - type into a DOM element', () => {
cy.viewport(1920, 1080);
cy.server()
.route("POST", '/api/v1/auth/sign-in')
.as('Login');
cy.server()
.route("GET", '/api/v1/user/vehicle/list')
.as('Vehicle');
cy.server()
.route("POST", '/api/v1/ride-book/list-data')
.as('Data');
cy.server()
.route("POST", '/api/v1/ride-book/list-settings')
.as('Settings');
cy.get('[data-cy="loginUsername"]')
.type("test_reader")
cy.get('[data-cy="loginPassword"]')
.type("test_reader");
cy.get('[data-cy="loginSubmit"]')
.click();
cy.wait('@Login', {timeout: 60000})
.should('have.property', 'status', 200);
cy.wait('@Vehicle', {timeout: 60000})
.should('have.property', 'status', 200);
cy.get('[data-cy="navigator-button-remove-all"]')
.click();
//Navigate to overview//
cy.get('#link-4')
.click();
cy.wait('@Settings', {timeout: 60000}, {multiple: true})
.should('have.property', 'status', 200);
cy.get('#vehicle-49162')
.click({force: true});
cy.wait('@Settings', {timeout: 60000}, {multiple: true})
.should('have.property', 'status', 200);
cy.wait('@Data', {timeout: 60000}, {multiple: true})
.should('have.property', 'status', 200);
});
}); Running on Windows 10 |
It would be complicated to provide more info due to the nature of the application, but I'm still exploring what's going on. Surprisingly, the problem does not happen when I run the same code against the production server - that gives me a really good idea of where to look. There are some differences in the production HTML to make it smaller, css names and json keys are minimized, no diagnostics code, etc. I would dearly like to use cypress instead of our complicated and brittle selenium setup, so I'm motivated to invest more time to find the issue. |
This is very strange. |
As suggested, I installed Cypress 3.5.0. It still fails in the same way, but different appearance. What's strange is that the cy.visit() line works. It's the cy.wait(500) which does not work. What is cy.wait doing that it fails thinking that there was an error in the page? And why would running against the web app through Cloudflare make it work fine? I would think cy.wait would be completely internal to Cypress. describe("Main page", () => {
it("can visit the main page", () => {
cy.visit("localhost:60606/");
cy.wait(500);
});
}); |
On my side i think the problem is also in my "Dynamic" waits because it doesnt wait until the assert is completed and want to continue the script. @rhassingerr you are doing more digging than cypress support :D |
@srotak5 This error is being thrown from a cross-origin script, so we don't have access to the error. This error is throwing from all versions of Cypress, so doesn't appear to be a recent regression. If you'd like to ignore Cypress failing when errors are thrown from cross-origin scripts, add the code below to your test file/suite. Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
}) If I ignore failing - I can see this error in the console now. Perhaps this is the script error that should have been evident before - that Cypress is swallowing for some reason. Without listener With listener @rhassingerr The error showing as |
Actually, now having the uncaught exception show up in the console I believe is a duplicate of this issue: #5698 |
@jennifer-shehane thank yout, this seems to work so far :) |
Is it possible that suppressed errors could be triggering the phantom error problem in cypress? Angular 1.x is well known for ignoring large numbers of errors caused by evals on missing objects and attributes in bits of code written inside HTML attributes. It chooses to do nothing rather than breaking and let the web developer figure it out. |
@jennifer-shehane I'm going to chalk this up to Angular 1.x behavior and not worth pursuing, unless @srotak5 comes back and says he's experiencing the same problem on a more current framework. I'm having zero problems on the Angular 9 rewrite so far. |
Since this issue hasn't had activity in a while, we'll close the issue until we can confirm this is still happening. Please comment if there is new information to provide concerning the original issue and we'd be happy to reopen. |
@jennifer-shehane @i am facing when I run cypress test this is the error coming from cypress
And this is my code
yesterday this code running proper but immediate error occurred |
@KrupalVaghasiya Likely your application is throwing an error. We can't help you because we cannot run the code you provided to see the Cypress tests run. Open your DevTools console and see if there's an error there. |
Hi, I have also observed this behaviour. However for me it only happens if I try to use the .click() function in separate it() functions. For example, this works:
But this doesn't:
My system details:
|
Current behavior:
When a failure happens in the test script, it's blaming the application code. In the example here, the cy.get() returns an object, but click() mysteriously fails. It does not fail if I remove the click(), but it will fail with the same CORS-related error if I change the image filename to something that doesn't exist on the page. The error takes up huge vertical space and is unhelpful despite all the verbiage.
This is an AngularJS 1.x SPA. There are no errors in the console. The app's .js file is served from the same origin as the html.
Intentionally bad code, such as cy.gxet(), shows an appropriate error, e.g.: "cy.gxet is not a function"
Desired behavior:
Tell me what really went wrong, if anything. It could be this is really an internal Cypress bug manifesting itself at cypress_runner.js:155859:20.
Test code to reproduce
Versions
Cypress 4.7.0
MacOS 10.15.5
Chrome 83
The text was updated successfully, but these errors were encountered: