Reputation: 1868
When developing Cypress tests, there is a cool test runner that automatically picks up cypress code changes and provides a nice GUI to view/debug your tests.
This works great for development on your own local machine, but the development workflow at my work has everyone's code on a remote development server, which we mount a remote folder onto our machines and develop that way.
Is there a way to utilize the test runner with this setup? Or is my team just stuck with cypress run
instead of cypress open
?
Upvotes: 22
Views: 9310
Reputation: 36
If you're able to control the installation of packages on your local machine, I often run locally against targets that are hosted elsewhere. As long as you have proper authentication to the AUT, you can run the Cypress GUI (cypress open) locally just fine. To keep the team in sync, we run a CI/CD pipeline in CirlceCI which also runs headlessly. This gives us the GUI for debugging and writing, while keeping something also running daily in CI as a teamwide source of truth.
Upvotes: 0
Reputation: 875
From my understanding, this is what is happening: Remote development via SSH. Everything works fine except Cypress. If you run cypress open
from a command line via SSH, it will try to launch Cypress on the remote machine.
To get Cypress to instead run on the local machine, the OP cloned the repo locally, ran npm install
and runs cypress open
from a local terminal. Since remote SSH is proxying the localhost, Cypress running locally is able to connect to the remote application. For example, VSCode SSH Remote proxies all ports automatically.
This is a simple approach. But any changes Cypress files will be on the local file system. You'll have to then copy/paste file changes manually from the local file system to the remote file system.
I've been trying to find the answer to this as well. It looks like Samba from WSL2 is pretty complicated - my idea was to install Cypress globally on my local machine and simply point it to a network drive.
Upvotes: 2
Reputation: 516
We ran into the same issue, as everyone on our team works on remote machines via SSH.
I ended up cloning the repo locally and opening the Cypress test runner on my host machine. The tests are then run against localhost (which is forwarded by my remote dev setup) without issues. It's not perfect, but it gets the job done.
Upvotes: 0