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.

Cypress fails to run with Chrome in headless mode

See original GitHub issue

Where to find the issue

Cypress Test Suite for cwa-website https://github.com/corona-warn-app/cwa-website/tree/master/cypress

Describe the issue

When running Cypress in headless mode using the Chrome browser, the test times out with the error:

Still waiting to connect to Chrome, retrying in 1 second (attempt 62/62)
Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds.

This usually indicates there was a problem opening the Chrome browser.

The CDP port requested was 51840.

Error: connect ECONNREFUSED 127.0.0.1:51840
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1142:16)

Steps to reproduce

Chrome times out:

npx cypress run --config baseUrl=https://coronawarn.app --spec cypress/integration/mime.js --browser chrome --headless

Electron and Firefox complete successfully

npx cypress run --config baseUrl=https://coronawarn.app --spec cypress/integration/mime.js --browser electron --headless

npx cypress run --config baseUrl=https://coronawarn.app --spec cypress/integration/mime.js --browser firefox --headless

Suggested change

Quick fix:

Comment out the line https://github.com/corona-warn-app/cwa-website/blob/37c86b68cabc829b5ce3758318e7b2cea31bec03/cypress/plugins/index.js#L9

Better fix:

Remove the viewport settings from cypress/plugins/index.js. It looks like they were added when visual comparisons were still part of the Cypress test suite. These were however abandoned a long time ago, so I believe the whole section regarding viewport settings is unnecessary.

Also clean up other related and unused files and folders cypress/integration/__image_snapshots__

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MikeMcC399commented, Jun 7, 2022

The following instructions now execute without error:

npx cypress run --config baseUrl=https://coronawarn.app --spec cypress/integration/mime.js --browser chrome --headless

1reaction
dsarkarcommented, Jun 1, 2022

@MikeMcC399 Thanks for opening this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress fails to run Chrome browser headlessly #6225 - GitHub
There is a bug in Cypress 3.8.0 that did not truly run Chrome headlessly when passing the --headless flag. To run Cypress in...
Read more >
Cypress: same tests that pass in browser fail in headless ...
I'm running Cypress 3.2.0 from a project created with vue-cli on Windows 10. Tested app is not a part of the project, is...
Read more >
Launching Browsers | Cypress Documentation
By default, we will launch Chrome in headlessly during cypress run . To run Chrome headed, you can pass the --headed argument to...
Read more >
cypress-io/cypress - Gitter
in my config to test cross origin iframe and it works fine in Chrome (cypress open) however, if I run the very same...
Read more >
Cypress Run Headless - ProgramsBuzz
1. Syntax · 2. Run Specific Spec File · 3. Cypress Chrome Headless · 4. Run Firefox in headed mode.
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