Run cypress tests in github actions, running up front-end and back-end http servers. #25999
-
Hi, i would like to run cypress tests on my Vue project linked to cypress dashboard in Github actions, triggered on push or pull events.
Now the goal is to have also a running server using:
So that i can get backend api listening on localhost:8000 (and vue in dev mode is refering to). But i can not get that to work. I have tried various configuration like this:
The backend server runs correctly on port 8000, but then the workflow is stuck there! It doesn’t continue on Cypress run because, i guess, it’s waiting the end of the process. Another solution that i have tried is to use two different jobs in parallel, but also this is not working because the two servers will not stop running. Then what if cypress tests run before the two servers are up? Can you suggest something else? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hi @alessandroamedei , To run a node.js app as a background service, you can start the Node JS server with nohup command as below.
Have you tried this method? If this could not work, It would be great if you could share a sample project here for me to investigate further. |
Beta Was this translation helpful? Give feedback.
-
Hi @yanjingzhu , thank you for the answer. Now i have this:
I am using two steps, i am doing :
But it is not working: It is still stuck. |
Beta Was this translation helpful? Give feedback.
-
The I tested it in powershell core on windows-latest runner, it could also work. Please try to add & at the end of the command which you want to run in backgroud . |
Beta Was this translation helpful? Give feedback.
-
Did you run the background process successfully? Did you meet the this situation. At the last step, a job named Complete Job will clean up the orphan process. And this step will clean up the backgroup process unfortunately. I don’t know how do deal with this. |
Beta Was this translation helpful? Give feedback.
The
&
symbol at the end of a command in bash will run the command in the background.I tested it in powershell core on windows-latest runner, it could also work.
Please try to add & at the end of the command which you want to run in backgroud .