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
?
Most testing tools (like Selenium) operate by running outside of the browser and executing remote commands across the network. Cypress is the exact opposite. Cypress is executed in the same run loop as your application.
Cypress provides two ways to test cases. Either using the Cypress UI Test Runner or from the CLI using the "cypress run" command. A specific test case can be executed on the CLI using the "--spec" option. We can change the browser for a specific test run on CLI using the "--browser" option.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With