Selenium/Node.js/Remote unix vm

For this example, we will target English Wikipedia at the Beta Cluster. You will need internet access.

Advantages edit

  • You do not have to install or learn how to use MediaWiki-Vagrant.
  • It will be reasonably fast.
  • Debugging failed tests will be easier, since you will see the browser.

Disadvantages edit

  • 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.
  • While the tests are running the host machine will be hard to use because Chrome will be opening and closing for every test (but not stealing focus).

Clone MediaWiki core edit

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 folder edit

$ cd mediawiki

Install dependencies edit

You will need internet access for this step. Depending on your operating system, installing dependencies will be different.

Chrome edit

sudo dpkg -i google-chrome*.deb
sudo apt-get -f install
  • Download ChromeDriver and put it in a folder included in PATH.
cd ~
wget https://chromedriver.storage.googleapis.com/2.30/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
export PATH=$PATH:~

Node.js edit

  • Install Node.js.
  • Install required npm packages.
$ npm install

xvfb edit

 sudo apt install xvfb
 export CHROME_BIN=/usr/bin/google-chrome
 export DISPLAY=:99.0
 sh -e /etc/init.d/xvfb start

Run the Selenium tests edit

replace en.formulasearchengine.com with your FQDN

export MW_SERVER=https://en.formulasearchengine.com
 xvfb-run npm run selenium

Please note that all tests will fail at the moment, but you will see reasonable screenshots of your login window in the log folder.