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-dev as example, but should work for any other local installation of MediaWiki as well.

Note that if you use MediaWiki-Vagrant, there is a dedicated page for running Selenium Node.js on MediaWiki-Vagrant.

Advantages
Compared to other ways of running the Selenium tests (such as via an on-demand Jenkins job):


 * Local tests should complete much quicker (typically under a minute).
 * 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.

Prerequisites

 * MediaWiki. We assume you have a mediawiki-docker-dev setup. It should be similar for other local MediaWiki installations.
 * Install Google Chrome.


 * Download ChromeDriver and ensure the program is in a folder included in your.
 * Install Node.js and npm.
 * Install FFmpeg:
 * On Linux:
 * On macOS:  (using Homebrew)
 * Other: Download from ffmpeg.org

Go to mediawiki folder
It's at  on my machine.

Install dependencies
You will need an internet access when doing this the first time.


 * Install required npm packages.

Run Selenium tests
The usual command to run the tests is. This requires setting up several environment variables so that the test knows how to reach your MediaWiki install and which credentials to use. To make this easier in the future, it is recommended to export these environment variables from a  file in your home directory (which means they are set by default in all terminal sessions).