Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/img/guides/rule-application-selection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/guides/vcxsrv-extra-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions content/guides/getting-started/installing-cypress.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ title: Installing Cypress
- How to install Cypress via `npm`
- How to install Cypress via direct download
- How to version and run Cypress via `package.json`
- How to run Cypress on `wsl2` in windows

</Alert>

Expand Down Expand Up @@ -515,3 +516,76 @@ Notes on pre-releases:
release over a pre-release - if you have a pre-release of Cypress vX.Y.Z
installed, the official release of Cypress vX.Y.Z will not install until you
do `cypress cache clear`.

### Windows Subsystem for Linux

#### WSL2

First, install the prerequisite packages using the command that relates to your
linux distribution ([Ubuntu/Debian](#Ubuntu-Debian) or [CentOS](#CentOS)).

We need to have an [X-server](https://en.wikipedia.org/wiki/X.Org_Server) to
display the Cypress UI from the linux subsystem. There are a variety of
X-servers available, here we are going to use VcXsrv, you can use any other
similar tool.

Download [VcXsrv](https://sourceforge.net/projects/vcxsrv/) and install. You can
set the settings to your preference ("Multiple windows" and "Start no client"
are recommended), but on the page that lets you enable extra settings, be sure
to select "Disable access control" which is required as WSL2 has its own IP
address, which changes often.

<DocsImage src="/img/guides/vcxsrv-extra-settings.png" alt="Disable access control in vcxsrv" ></DocsImage>

In your `.bashrc` (or equivalent such as `.zshrc`) set the `DISPLAY` environment
variable.

```shell
# set DISPLAY variable to the IP automatically assigned to WSL2
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
```

To confirm `DISPLAY` variable has been set, print it out in the terminal. You
may need to restart your terminal to see this change.

```shell
echo $DISPLAY
# something like 172.17.224.1:0.0
```

The VcXsrv GUI uses [D-Bus](https://www.freedesktop.org/wiki/Software/dbus/) to
internally communicate. After the `export DISPLAY` line in your `.bashrc`, add
the following:

```shell
sudo /etc/init.d/dbus start &> /dev/null
```

Now your user needs to be granted access to run `sudo dbus` without needing to
enter a password. To do so, use the `visido` command:

```shell
sudo visudo -f /etc/sudoers.d/dbus
```

In the editor that launches, add the following line, replacing `<your_username>`
with your username (you can use the `whoami` command to print your username if
you don't know it).

```
<your_username> ALL = (root) NOPASSWD: /etc/init.d/dbus
```

Go to Control Panel > System and Security > Windows Defender Firewall > Inbound
Rules > New Rule.

<DocsImage src="/img/guides/windows-firewall-disable-vcxsrv.png" alt="Add rule to allow connections for vcxsrv" ></DocsImage>

Select Program and click on next. On the This program path, browse and select
path to VcxSrv. On the next page select allow the connection and click next. On
the next page, select all three options (Domain, Private, Public).

<DocsImage src="/img/guides/rule-application-selection.png" alt="Select inbound rule application cases for vcxsrv" ></DocsImage>

Give the rule a suitable name and description and click finish. WSL2 should now
be able to open a GUI from shell.