Merge "maintenance: Document secondary purpose of --server"
[lhc/web/wiklou.git] / tests / selenium / README.md
1 # Selenium tests
2
3 ## Prerequisites
4
5 - [Chrome](https://www.google.com/chrome/)
6 - [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/)
7 - [Node.js](https://nodejs.org/en/)
8 - [MediaWiki-Vagrant](https://www.mediawiki.org/wiki/MediaWiki-Vagrant)
9
10 Set up MediaWiki-Vagrant:
11
12 cd mediawiki/vagrant
13 vagrant up
14
15 ## Installation
16
17 cd mediawiki
18 npm install
19
20 ## Usage
21
22 npm run selenium
23
24 By default, Chrome will run in headless mode. If you want to see Chrome, set DISPLAY
25 environment variable to any value:
26
27 DISPLAY=:1 npm run selenium
28
29 To run only one file (for example page.js), you first need to spawn the chromedriver:
30
31 chromedriver --url-base=wd/hub --port=4444
32
33 Then in another terminal:
34
35 cd tests/selenium
36 ../../node_modules/.bin/wdio --spec specs/page.js
37
38 To run only one test (name contains string 'preferences'):
39
40 ../../node_modules/.bin/wdio --spec specs/user.js --mochaOpts.grep preferences
41
42 The runner reads the config file `wdio.conf.js` and runs the spec listed in
43 `page.js`.
44
45 The defaults in the configuration files aim are targeting a MediaWiki-Vagrant
46 installation on http://127.0.0.1:8080 with a user Admin and
47 password 'vagrant'. Those settings can be overridden using environment
48 variables:
49
50 `MW_SERVER`: to be set to the value of your $wgServer
51 `MW_SCRIPT_PATH`: ditto with $wgScriptPath
52 `MEDIAWIKI_USER`: username of an account that can create users on the wiki
53 `MEDIAWIKI_PASSWORD`: password for above user
54
55 Example:
56
57 MW_SERVER=http://example.org MW_SCRIPT_PATH=/dev/w npm run selenium
58
59 ## Links
60
61 - [Selenium/Node.js](https://www.mediawiki.org/wiki/Selenium/Node.js)