web application doesn't load correctly with Cypress
See original GitHub issueMy team is working on a web application and we decided to use Cypress for automated tests. Problem is, when we run these tests, they only get past login screen. Home screen doesn’t load correctly. This happens ONLY in Chrome driven by Cypress and Electron driven by Cypress. In normal Chrome the application runs without errors.
Current behavior:
When running Cypress tests, web application doesn’t load correctly and console displays these errors on home screen:
Uncaught SyntaxError: Invalid or unexpected token
Uncaught Error: Cannot find module 'jquery'
Uncaught Error: Cannot find module 'angular-cookies'
Desired behavior:
Behaviour should be the same in standalone Chrome and Chrome driven by Cypress (and Electron).
Versions
Windows 10 Cypress 3.2.0, Chrome 74, Electron 59
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
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
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 >Web page is not getting loaded in Cypress browser
Web page is not getting loaded in cypress associated browser including Chrome, Electron, Edge, and when I try to run it in any...
Read more >Cypress cy.intercept Problems - Gleb Bahmutov
Once the page is loaded, the application fetches the todo items, and everything is working as expected. The intercept works correctly ...
Read more >The top 7 advanced features of Cypress to know about
The test runner is framework-agnostic; thus it can work with both popular major web development frameworks like Vue.JS, React, Angular, Elm, but ...
Read more >Web Security - Cypress - w3resource
You will notice that Chrome displays a warning that the 'SSL certificate does not match'. This is a normal and correct warning. This...
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 FreeTop 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
Top GitHub Comments
We fixed the issue. The problem was that when we opened first
Uncaught SyntaxError - Invalid token
, we found this:The same file run on the standalone Chrome was loaded correctly, so it had to be issue with Cypress encoding. After some googling we found that Cypress settings has a default settings with this property:
"modifyObstructiveCode": true
https://on.cypress.io/configuration#modifyObstructiveCode
After setting it to
false
it works well.Hello Jennifer. I’m new in cypress and I’m getting this error too, but I don’t identify how can localice the “wrong” code. The Dev team made some changes last week and I started to get this error today that I have updated project, and I don’t know how to tell them what search for and adjust. If I add (“modifyObstructiveCode”: false) to the config, my script runs but i don’t know if this can affect other scripts.