cypress: Cypress run won’t finish, stuck while making connection to Chrome
Current behavior:
I’m getting error: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying during my tests. Usually happens during one of last tests (probably the last). I have multiple Cypress projects, happens on all of them. Tests are running in parallel, on Chrome.
Test code to reproduce
Issue happens quite randomly, I’m sorry, but I cannot really give a reproducible example, since this happens in CI only. Sending screenshots.
Versions
Cypress 4.0.2 CI: Bitbucket Pipelines Image: cypress/browsers:node13.6.0-chrome80-ff72
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 9
- Comments: 42 (6 by maintainers)
I assume that this problem is a copy of #7450. I solved my problem by adding the following workaround provided by @stevejefferies.
To run all test in edge without problems, you have to extend the if condition by adding the following:
Now, tests are running fine in chrome as well as in egde using headless mode.
I was missing the line
127.0.0.1 localhostin my /etc/hosts file. Afterwards it worked perfectly!@tipsey same config . how to fix it ?
@simisimon That doesn’t work for me, unfortunately
Well, for me it just started to work magically without changing anything. During the period of time when cypress was not working with Chrome I have used Brave and everything was fine.
@simisimon !!! now we can finally run in chrome! every test file now runs 10-20 seconds faster THX 👍 🥇
Hey @jennifer-shehane thank you for taking a look into it. I have been experiencing this lot less recently, but I can’t put my finger down on what might have caused this.
to answer your questions:
I’ll make sure to run with a debug if it might happen in close future
@79it You can modify the launch args sent to Chrome by following the instructions here: https://on.cypress.io/browser-launch-api#Modify-browser-launch-arguments
I’ve reviewed the comments/logs here and have not found many commonalities between the environments across people reporting this problem. A couple of things that are common:
I haven’t fully verified the 3rd assertion, but from the few logs provided, they all indicated that the error occurred after a large number of spec files ran (38+).
Some questions:
Please if you can answer the questions below if you’re experiencing this issue.
cypress runon the single machine until this error occurs?I guess my theory is that this may be related to longer runs or runs that connect to the CDP several times over several spec files.
Also, tracking these debug logs specifically may be helpful in seeing if any leftover processes haven’t existed properly.
DEBUG=cypress:*,cypress-verbose:server:util:process_profiler@jennifer-shehane
Reporting in, I’m running into the same issue. using WSL 2 on Windows
`Title: Error launching browser
Message: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds.
This usually indicates there was a problem opening the Chrome browser.
The CDP port requested was <span class="ansi-yellow-fg">36647</span>.
Error details:
Error: connect ECONNREFUSED 127.0.0.1:36647 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)
Stack trace:
Let me know if DEBUG is needed as well and I can provide. FYI this problem only happens when running chrome. Headless works fine. I had this problem since Cypress 3.8 or so after upgrading to 4.1 issue still persists. It working before 3.8 as far as I recall