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.

web application doesn't load correctly with Cypress

See original GitHub issue

My 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

17reactions
pinko2512commented, May 2, 2019

We fixed the issue. The problem was that when we opened first Uncaught SyntaxError - Invalid token, we found this: 04

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.

3reactions
paopao1983commented, Aug 5, 2019

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.

image

Read more comments on GitHub >

github_iconTop 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 >

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