Cypress fails to run with Chrome in headless mode
See original GitHub issueWhere 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:
- Created a year ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
The following instructions now execute without error:
npx cypress run --config baseUrl=https://coronawarn.app --spec cypress/integration/mime.js --browser chrome --headless
@MikeMcC399 Thanks for opening this issue.