You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tests/automated-tests.md
+76Lines changed: 76 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -33,3 +33,79 @@ To run all Playwright tests locally, open a terminal outside the devcontainer an
33
33
```bash
34
34
docker compose run --rm playwright
35
35
```
36
+
37
+
### Running in headed mode
38
+
39
+
To run Playwright in headed mode, you need to enable X11 forwarding.
40
+
41
+
Some steps are required for macOS and Windows to check that you have an X Server.
42
+
43
+
#### macOS
44
+
45
+
macOS doesn't provide a built-in X Server, so you'll need to install XQuartz which will provide one:
46
+
47
+
- Install XQuartz: `brew install --cask xquartz`
48
+
- Open XQuartz, go to Preferences -> Security, and check “Allow connections from network clients”
49
+
- Restart your computer (restarting XQuartz might not be enough)
50
+
- Start XQuartz with `xhost +localhost`
51
+
52
+
#### Windows
53
+
54
+
Windows provides an X Server as a part of Windows Subsystem for Linux (WSL).
55
+
56
+
To verify that WSL and WSL GUI are installed and running:
57
+
58
+
- Launch WSL from the Start Menu
59
+
- In the Linux terminal that opens, verify that the directory `/mnt/wslg` exists by running:
60
+
61
+
```bash
62
+
ls -a -w 1 /mnt/wslg
63
+
```
64
+
65
+
and that it contains these files:
66
+
67
+
```
68
+
.
69
+
..
70
+
.X11-unix
71
+
PulseAudioRDPSink
72
+
PulseAudioRDPSource
73
+
PulseServer
74
+
distro
75
+
doc
76
+
dumps
77
+
pulseaudio.log
78
+
runtime-dir
79
+
stderr.log
80
+
versions.txt
81
+
weston.log
82
+
wlog.log
83
+
```
84
+
85
+
If you don't see WSL in the Start Menu or the `ls` command fails, you need to install WSL.
86
+
87
+
#### Set `DISPLAY` environment variable
88
+
89
+
In your `.env` file, set `DISPLAY` to the value for your operating system:
90
+
91
+
- macOS: `host.docker.internal:0`
92
+
- Linux: `$DISPLAY`
93
+
- Windows: `:0`
94
+
95
+
For example, for macOS, you'd add this line to your `.env` file:
96
+
97
+
```
98
+
DISPLAY=host.docker.internal:0
99
+
```
100
+
101
+
!!! info
102
+
103
+
The steps above are adapted from [https://www.oddbird.net/2022/11/30/headed-playwright-in-docker/](https://www.oddbird.net/2022/11/30/headed-playwright-in-docker/).
104
+
105
+
#### Run all tests in headed mode
106
+
107
+
In `tests/playwright/pytest.ini`, add `--headed` to `addopts`, and run all tests with the same command as before:
0 commit comments