ECONNREFUSED error for Angular app when making a request outside of app first. #25301
Unanswered
ChristianPavilonis
asked this question in
Questions and Help
Replies: 1 comment
-
did you ever found a solution to this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm encountering strange behavior for my tests when my test makes a request to an API to setup some data first before
cy.visit()
is called.My project has an angular frontend with an express api, to reset my data and login before tests I make a request to the express backend using
cy.request('localhost:3000/...
then I callcy.visit('/');
I get theECONNREFUSED
error. And I have to kill cypress and start over.But, if I comment out my
cy.request()
method first, run the tests, they will visit correctly, then I can un-comment out the code and all my tests will work.Example:
This will create the error:
This fixes the error, but I must first exit cypress, reopen it, remove the code, run it once, finally add the code back, then I can work.
The
refreshDatabase
command looks like:Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions