X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fselenium%2FREADME.md;h=038b75729e6d38f7e90c0554a5d2746a156e716d;hb=46586a243c6adf6a7020608173ba5a73fb97ee72;hp=16283772a01509192c4bf13beaefeb60b5c4dab7;hpb=8a4a8a8dcbaf454c9f64cd8b5ba90704d7721500;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/selenium/README.md b/tests/selenium/README.md index 16283772a0..038b75729e 100644 --- a/tests/selenium/README.md +++ b/tests/selenium/README.md @@ -5,9 +5,8 @@ - [Chrome](https://www.google.com/chrome/) - [ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver/) - [Node.js](https://nodejs.org/en/) -- [MediaWiki-Vagrant](https://www.mediawiki.org/wiki/MediaWiki-Vagrant) -Set up MediaWiki-Vagrant: +If using MediaWiki-Vagrant: cd mediawiki/vagrant vagrant up @@ -21,36 +20,55 @@ Set up MediaWiki-Vagrant: npm run selenium -To run only one file (for example page.js), you first need to spawn the chromedriver: +There are three supported modes of running the tests: - chromedriver --url-base=wd/hub --port=4444 +- Headless. It's the default. You will not see the browser while tests are + running because it's running in a headless mode. This mode should run fine + on all supported platforms. +- Headless recording. Set DISPLAY environment variable to a value that starts + with colon (`:`) and video of each test will be recorded. Browser will run + headless. Recording videos works only on Linux. +- Visible. If you want to see the browser, set DISPLAY environment variable to + any value that does not start with colon. This mode will not work in a + headless environment like MediaWiki-Vagrant. + +Example recording session: + + sudo apt-get install chromedriver ffmpeg xvfb + export DISPLAY=:94 + Xvfb "$DISPLAY" -screen 0 1280x1024x24 & + npm run selenium -Then in another terminal: +Example visible session: + + DISPLAY=1 npm run selenium + +To run only one test (for example specs/page.js), you first need to start Chromedriver: + + chromedriver --url-base=wd/hub --port=4444 - cd tests/selenium - ../../node_modules/.bin/wdio --spec specs/page.js +Then, in another terminal: -To run only one test (name contains string 'preferences'): + npm run selenium-test -- --spec tests/selenium/specs/page.js - ../../node_modules/.bin/wdio --spec specs/user.js --mochaOpts.grep preferences +You can also filter specific cases, for ones that contain the string 'preferences': -The runner reads the config file `wdio.conf.js` and runs the spec listed in -`page.js`. + npm run selenium-test -- tests/selenium/specs/user.js --mochaOpts.grep preferences -The defaults in the configuration files aim are targetting a MediaWiki-Vagrant -installation on installation on http://127.0.0.1:8080 with a user Admin and -password 'vagrant'. Those settings can be overriden using environment +The runner reads the configuration from `wdio.conf.js`. The defaults target +a MediaWiki-Vagrant installation on `http://127.0.0.1:8080` with a user "Admin" +and password "vagrant". Those settings can be overridden using environment variables: -`MW_SERVER`: to be set to the value of your $wgServer -`MW_SCRIPT_PATH`: ditto with $wgScriptPath -`MEDIAWIKI_USER`: username of an account that can create users on the wiki. -`MEDIAWIKI_PASSWORD`: password for above user +- `MW_SERVER`: to be set to the value of your $wgServer +- `MW_SCRIPT_PATH`: ditto with $wgScriptPath +- `MEDIAWIKI_USER`: username of an account that can create users on the wiki +- `MEDIAWIKI_PASSWORD`: password for above user Example: MW_SERVER=http://example.org MW_SCRIPT_PATH=/dev/w npm run selenium -## Links +## Further reading - [Selenium/Node.js](https://www.mediawiki.org/wiki/Selenium/Node.js)