Selenium/Getting Started/Run tests using Fresh

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 2 minutes on my machine. (As of October 2019.)
 * Works without an internet connection.
 * Doesn't require installing Vagrant.
 * Doesn't require installing ChromeDriver or FFmpeg (compared to bare installs).
 * Doesn't require executing npm packages directly on your machine (which is scary).

Disadvantages

 * You need to have Docker installed.

Prerequisites

 * MediaWiki. We assume you have a MediaWiki-Docker setup. It should be similar for other local MediaWiki installations.
 * Docker. See Docker CE for Linux, Docker for Mac, or Docker for Windows.
 * Install the Wikimedia Fresh CLI for Docker.

Environment variables
If you use MediaWiki-Docker with an  file, then these are read automatically. Otherwise, make sure the following are set:,  ,  , and. See the mediawiki-docker-dev tutorial for more details.

Run Selenium tests
Next, navigate to where you have the MediaWiki core repository and start a Fresh session (let it see environment variables, and grant networking to access for your MediaWiki install):

The first time (or after updating MediaWiki), install the npm packages used by MediaWiki's browser tests:

Run Chromedriver:

And finally, run the tests: