wiki.techinc.nl/tests/selenium
Željko Filipin 0d9b1e699a selenium: Fix 'Page should be editable'
The test was failing because a popup was added to the beta cluster.

Popup text:
Download a browser extension to get new features and help us improve Wikipedia

Bug: T270771
Change-Id: I6ba0026fcaa05610d4a310605f5ff6ae93705bc0
2024-10-08 15:06:39 +00:00
..
docs selenium: Replace Node.js Assert library with WebdriverIO Expect library 2024-09-19 10:57:35 +02:00
pageobjects auth: Disable irrelevant account creation fields for temp users 2024-09-10 16:45:56 +02:00
specs selenium: Fix 'Page should be editable' 2024-10-08 15:06:39 +00:00
wdio-mediawiki selenium: Replace Node.js Assert library with WebdriverIO Expect library 2024-09-19 10:57:35 +02:00
.eslintrc.json ESLint: Enforce prefer-arrow-callback and autofix 2024-06-11 19:03:54 +01:00
README.md
wdio.conf.js selenium: Move code for Selenium/Getting Started/Create a simple test 2024-07-22 13:48:49 +00:00

Selenium tests

Getting started

See https://www.mediawiki.org/wiki/Selenium 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-test

Or:

DISPLAY= npm run selenium-test

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-test

Video recording

To capture a video, the tests have to run in the context of an X11 server, with the DISPLAY environment variable set to its display name. If the shell has no X11 server or if you want to hide the output, you can also launch a virtual X11 display using Xvfb. Recording videos is currently supported only on Linux, and is triggered by the DISPLAY value starting with a colon (as Xvfb typically would).

Example test run in Fresh.

fresh-node -env -net
export DISPLAY=:1
Xvfb "$DISPLAY" -screen 0 1280x1024x24 &
npm run selenium-test

Filter

Run a specific spec:

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

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

npm run selenium-test -- --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