Selenium/How-to/Run tests targeting MediaWiki-Docker using Fresh

Jump to navigation Jump to search

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.


  • 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).


  • You need to have Docker installed.


Environment variables[edit]

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

Run Selenium tests[edit]

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):

you:~$ cd mediawiki
you:mediawiki$ fresh-node -env -net
## env: MW_*, MEDIAWIKI_*
# net: expose host

🌱  Fresh!

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

nobody@(...):/mediawiki$ npm ci

added 1550 packages in 254.956s

Run Chromedriver:

nobody@(...):/mediawiki$ chromedriver --url-base=wd/hub --port=4444 &
[1] 64
Starting ChromeDriver 71.0.3578.80 on port 4444
Only local connections are allowed.

And finally, run the tests:

nobody@(...):/mediawiki$ npm run selenium-test
  14 passing (281.40s)