Selenium/Getting Started/Run tests targeting MediaWiki-Docker

This page describes how to run Selenium tests locally on your development install of MediaWiki. This tutorial is based on the setup from MediaWiki-Docker.

Advantages

 * It will be fast, since the target machine is local. MediaWiki core Selenium test run takes about 4 minutes on my machine. (As of September 2019.)
 * Works without an internet connection.

Disadvantages

 * You will have to install MediaWiki, Selenium and their dependencies on your machine.
 * You will be executing over 900 JavaScript packages (as of August 2019) directly on your machine with access to all personal/work files.

Install dependencies
Depending on your operating system, installing dependencies will be different.

MediaWiki

 * We assume you have a MediaWiki-Docker setup. It should be similar for other local MediaWiki installations.

Browser

 * Install Google Chrome or Chromium.

Node.js

 * Install Node.js and npm.
 * Install required npm packages.

Check if  environment variable is set with. If there's no output, that's good. (The default on macOS). If you get any output, for example  (the default on Ubuntu Linux), unset the variable with.

For more information see Selenium/How-to/Make the browser visible or hidden and Selenium/How-to/Record videos of test runs.

and
This is an optional step. Check if you have these environment variables already set in terminal (for example with ) or in   file (for example with  ). If not, read on.

Ensure the following environment variables are set. Either run this manually from the terminal or, to make it easier for next time, set them from shell configuration file (, ...) which means the variables are always available from any terminal session:

Or create a  file at the root of the MediaWiki repository: