Selenium/Getting Started/Run tests targeting Beta cluster

For this example, we will target English Wikipedia at the Beta Cluster.

Target beta cluster.png

AdvantagesEdit

  • You do not have to install or learn how to use MediaWiki-Vagrant.
  • It will be reasonably fast. MediaWiki core Selenium test run takes about 5 minutes on my machine. A lot of tests fail. Subset of passing tests takes about 1 minute. (As of September 2019.)
  • Debugging failed tests will be easier, since are able to see the browser using DISPLAY environment variable. See README.md for more information.

DisadvantagesEdit

  • You will need internet connection while running the tests.
  • The tests will be slower since the target machine is not local.
  • You will have to install Selenium and it's dependencies on your machine.

Clone MediaWiki coreEdit

There are several ways to clone the MediaWiki core repository (anonymous http, http, ssh). We will use anonymous http since it is the simplest.

$ git clone https://gerrit.wikimedia.org/r/mediawiki/core mediawiki

Go to mediawiki folderEdit

cd mediawiki

Install dependenciesEdit

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

ChromeEdit

Node.jsEdit

  • Install Node.js.
  • Install required npm packages.
npm ci

Environment variablesEdit

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 (~/.bash_profile, ~/.zshrc...) which means the variables are always available from any terminal session:

export MEDIAWIKI_USER=mediawiki_user
export MEDIAWIKI_PASSWORD=mediawiki_password
export MW_SERVER=https://en.wikipedia.beta.wmflabs.org

Of course, replace mediawiki_user and mediawiki_password with your user and password.

Run the Selenium testsEdit

In one terminal tab or window, start chromedriver.

chromedriver --url-base=wd/hub --port=4444

Run all tests.

npm run selenium-test

Please note that a lot of tests will fail. Tests are written for targeting MediaWiki on a Jenkins worker machine and MediaWiki-Vagrant virtual machine.

If you would like to run a subset of passing tests, run these commands in separate terminal windows or tabs.

npm run selenium-daily