Selenium/How-to/Run tests inside MediaWiki-Vagrant

From mediawiki.org
Jump to navigation Jump to search
Warning Warning: Instructions on this page are not working at the moment. See T236282.

For this example, we will not enable any roles and we will use MediaWiki core.

From MediaWiki-Vagrant machine.png

Advantages[edit]

Running Selenium tests from inside MediaWiki-Vagrant machine has several advantages:

  • You do not have to install anything on your machine, except MediaWiki-Vagrant itself, and it's dependencies.
  • It will be fast, since the target machine is local. MediaWiki core Selenium test run takes about 3 minutes on my machine. (As of September 2019.)
  • After everything is set up, you do not need internet connection.
  • You are probably already familiar with MediaWiki-Vagrant and have it installed.
  • While the tests are running, you can continue using your machine as usual, because everything is happening inside the virtual machine.

Disadvantages[edit]

  • You might not be familiar with MediaWiki-Vagrant, so you will have to learn how to install and use yet another tool.
  • You will have to install MediaWiki-Vagrant and it's dependencies on your machine.
  • The machine is headless (no display) so it is harder to debug failed tests, but not impossible.

Set up MediaWiki-Vagrant[edit]

Boot the machine[edit]

$ vagrant up

SSH into the machine[edit]

$ vagrant ssh

Go to mediawiki folder[edit]

vagrant@vagrant:~$ cd /vagrant/mediawiki

Install dependencies in the machine[edit]

vagrant@vagrant:/vagrant/mediawiki$ sudo apt-get install chromedriver

[citation needed]

vagrant@vagrant:/vagrant/mediawiki$ npm install

Run the Selenium tests[edit]

vagrant@vagrant:/vagrant/mediawiki$ npm run selenium

Exit the machine[edit]

  • ctrl+d or logout
vagrant@vagrant:~$ logout

suspend or halt the machine[edit]

$ vagrant suspend

or

$ vagrant halt