wiki.techinc.nl/tests/selenium
Ed Sanders d94f90e088 eslint: Code style fixes for upcoming config change
Change-Id: Ief44c0bb26c5a1c1773cab5dba51d5e856612bf7
2020-05-14 22:19:55 +01:00
..
pageobjects [selenium] Make tests skin agnostic 2020-03-25 16:21:18 +01:00
specs eslint: Code style fixes for upcoming config change 2020-05-14 22:19:55 +01:00
wdio-mediawiki eslint: Code style fixes for upcoming config change 2020-05-14 22:19:55 +01:00
.eslintrc.json eslint: Use correct global values, and use jquery rules in selenium tests 2019-10-08 13:12:17 +01:00
README.md Selenium: Use wdio-video-reporter to record videos of test run 2020-05-14 19:24:10 +02:00
selenium.sh tests: Enable 'npm run selenium' on Windows 2020-03-15 21:46:50 +00:00
wdio.conf.js Selenium: Use wdio-video-reporter to record videos of test run 2020-05-14 19:24:10 +02:00

Selenium tests

Getting started

See https://www.mediawiki.org/wiki/Selenium/Node.js for how to best run these locally. Below the internal prerequisites are documented, but you might not need to install these yourself.

Prerequisites

Usage

There are three supported modes of running the tests.

Headless

The Selenium tests default to headless mode, unless a DISPLAY environment variable is set. This variable may be set on Linux desktop and XQuartz environments. To run headless there, unset the DISPLAY environment variable first.

npm run selenium

Or:

DISPLAY= npm run selenium

Visible browser

To see the browser window, ensure the DISPLAY variable is set. On Linux desktop and in XQuartz environments this is probably set already. On macOS, set it to a dummy value like 1.

DISPLAY=1 npm run selenium

Video recording

Starting from WebdriverIO v5, wdio-video-reporter NPM package is used to record videos of test runs. By default, videos for all tests are recorded and saved under tests/selenium/log directory.

Filter

Run a specific spec:

npm run selenium -- --spec tests/selenium/specs/page.js

To filter by test case, e.g. with the name containing "preferences":

npm run selenium -- --mochaOpts.grep preferences

Configuration

The following environment variables decide where to find MediaWiki and how to login:

  • MW_SERVER: The value of $wgServer.
  • MW_SCRIPT_PATH: The value of $wgScriptPath.
  • MEDIAWIKI_USER: Username of a wiki account with sysop rights.
  • MEDIAWIKI_PASSWORD: Password for this user.

Further reading