question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in cypress_runner.js is reported as "error originated from your application code, not from Cypress"

See original GitHub issue

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.

image

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

describe("Click image button", () => {
  it('Flip image', () => {
    cy.visit("/puzzles/math-search.html");
    cy.get('[ng-src="/images/form/math_search_addition.gif"]').click();
  });
});

Versions

Cypress 4.7.0 MacOS 10.15.5 Chrome 83

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rhassingerrcommented, Jun 8, 2020

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.

0reactions
anilpujaraofficialcommented, Mar 3, 2022

Capture

Read more comments on GitHub >

github_iconTop Results From Across the Web

The following error originated from your application code, not ...
Try adding this in support/index.js : import './commands' Cypress.on('uncaught:exception', (err, runnable) => { // returning false here ...
Read more >
Error Messages | Cypress Documentation
We found an error preparing your test file. This message means that Cypress encountered an error when compiling and/or bundling your test file....
Read more >
cypress fix this problem, or use {force: true} to disable error ...
Desired behavior: The double click function gets NO error as click function works. Steps to reproduce: (app code and test code).
Read more >
Handle Service Unavailable and Uncaught Exception in ...
In this video, I have explained how to solve handle service unavailable error and Uncaught Exception in Cypress.
Read more >
Solved: 'The following error originated from your application ...
Have you got the same error while executing your cypress tests? ... Add the following code into your Support/index.js file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found