Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Cypress Test Runner on Remote Development Server

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?

like image 780
GabeMeister Avatar asked Dec 20 '18 01:12

GabeMeister


People also ask

Does Cypress support remote execution?

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.

How do you run Cypress tests with Cypress test runner?

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.


1 Answers

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.

like image 142
Nicholas Boll Avatar answered Sep 22 '22 06:09

Nicholas Boll