cy.visit randomly not loading the web application.
See original GitHub issueI am testing Cypress to see If we can use it for the automation of our test cases.
I have created 4 test cases. And, cy.visit(desired link)
is placed in beforeEach
Current behavior:
Sometimes all four of them run and pass without issues. Randomly, web application doesn’t load correctly for one of the four test cases. Console displays the following message:
Uncaught syntax error: Unexpected end of input
Desired behavior:
Every time cy.visit(desired link)
is launched I should be able to land on the Login screen.
Versions:
Windows 10 Pro Cypress 3.8.1 Chrome 79
I have also added "modifyObstructiveCode":false
in the cypress.json
Issue screenshot attached.
If somebody knows what’s happening and how can it be fixed, please let me know. Thank you.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Cypress cy.visit doesn't load a website, Timed out after waiting
I have no previous experience working with Cypress and i'm stuck on such simple problem - cypress can't reach the united.com website.
Read more >Troubleshooting | Cypress Documentation
Open Cypress via cypress open · Go to Developer Tools -> View App Data · This will take you to the directory in...
Read more >Cypress cy.intercept Problems - Gleb Bahmutov
Imagine you are trying to check how your application handles a network communication error. Internet is unreliable, servers go down and come ...
Read more >Cypress tests fail randomly
cypresserror: cy.visit() failed trying to load: ... cy.visit () failed because you are attempting to visit a different origin domain Two URLs have...
Read more >End-to-End Testing with Cypress and Auth0
If you do not know Cypress, check out this article for more. ... Visit the web application and invoke a redirect to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sarfrazwk Your application may be using “frame busting”. By default Cypress modifies code it detects as frame busting so the application under test runs properly in the Cypress Test Runner (which runs your app inside an iframe itself). Can you try disabling this by setting
modifyObstructiveCode=false
in your configuration? Further explanation can be found here: https://on.cypress.io/configuration#modifyObstructiveCodeThis is a bit of a guess though since I can’t run the code provided.
I had the same issue, the fix took me a while. My problem was with how angular mangles the
index.html
file.the code would turn into a single line of js, leading to a
Unexpected end of input
Which would lead to the end of the code being commented out. Turning them into multi-line comments did the trick.