Debian Codegraph @

tests/selenium/README.md

raw symbols SCIP
1 # Selenium tests
2
3 ## Getting started
4
5 See <https://www.mediawiki.org/wiki/Selenium> for how to best
6 run these locally. Below the internal prerequisites are documented,
7 but you might not need to install these yourself.
8
9 ## Prerequisites
10
11 - [Chromium](https://www.chromium.org/Home) or [Chrome](https://www.google.com/chrome)
12 - [Node.js](https://nodejs.org)
13
14 ## Usage
15
16 There are three supported modes of running the tests.
17
18 #### Headless
19
20 The Selenium tests default to headless mode, unless a `DISPLAY` environment variable is set.
21 This variable may be set on Linux desktop and XQuartz environments. To run headless there,
22 unset the `DISPLAY` environment variable first.
23
24 npm run selenium-test
25
26 Or:
27
28 DISPLAY= npm run selenium-test
29
30 ### Visible browser
31
32 To see the browser window, ensure the `DISPLAY` variable is set. On Linux desktop and in XQuartz
33 environments this is probably set already. On macOS, set it to a dummy value like `1`.
34
35 DISPLAY=1 npm run selenium-test
36
37 ### Video recording
38
39 To capture a video, the tests have to run in the context of an X11 server, with the `DISPLAY`
40 environment variable set to its display name. If the shell has no X11 server or if you want
41 to hide the output, you can also launch a virtual X11 display using Xvfb. Recording videos
42 is currently supported only on Linux, and is triggered by the `DISPLAY` value starting with
43 a colon (as Xvfb typically would).
44
45 Example test run in [Fresh](https://gerrit.wikimedia.org/g/fresh).
46
47 fresh-node -env -net
48 export DISPLAY=:1
49 Xvfb "$DISPLAY" -screen 0 1280x1024x24 &
50 npm run selenium-test
51
52 ## Filter
53
54 Run a specific spec:
55
56 npm run selenium-test -- --spec tests/selenium/specs/page.js
57
58 To filter by test case, e.g. with the name containing "preferences":
59
60 npm run selenium-test -- --mochaOpts.grep preferences
61
62 ## Configuration
63
64 The following environment variables decide where to find MediaWiki and how to login:
65
66 - `MW_SERVER`: The value of `$wgServer`.
67 - `MW_SCRIPT_PATH`: The value of `$wgScriptPath`.
68 - `MEDIAWIKI_USER`: Username of a wiki account with sysop rights.
69 - `MEDIAWIKI_PASSWORD`: Password for this user.
70
71 ## Further reading
72
73 - [Selenium](https://www.mediawiki.org/wiki/Selenium) on mediawiki.org