3

I'm having intermittent issues running some automated e2e tests written in Cypress. Apparently I'm the only one having this issue so it might be isolated to my laptop. The strange thing is it happens intermittently.

When I run the tests and cypress tries to browse to our app I get the following error:

`CypressError cy.visit() failed trying to load:

http://localhost:4200/

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

Error: connect ECONNREFUSED 127.0.0.1:4200

Common situations why this would fail:

  • you don't have internet access
  • you forgot to run / boot your web server
  • your web server isn't accessible
  • you have weird network configuration settings on your computer`

If I open a new tab in the instance of Chrome that is controlled by Cypress I also get the same error.

If I open a standard instance of Chrome (not controlled by Cypress) the page loads fine.

The really weird thing is I can put money if I try again in a couple of hours it will just start working.

Anyone got any hunches on this one because I'm clueless or not sure how to debug.

Tom Miller
  • 31
  • 3

2 Answers2

3

I stumbeled over an answer to this issue. I have no idea why, but for me this appeared from one day to another. From working everywhere to working nowhere, except for CI builds which is even stranger.

The answer that helped me was to pass --host 0.0.0.0 to the angular server I'm testing against. I have no idea why 127.0.0.1 is not regarded local for me (and my colleagues with different OSs as well) anymore, but it just seems to be like this for some reason.

Markus Duft
  • 151
  • 1
  • 5
0

I faced the same issue. try to run

npx cypress open

from cmd as administrator.

awaisx
  • 1
  • 1