Selenium/Ruby/Inside MediaWiki-Vagrant virtual machine
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date.
See Selenium instead.
For this example, we will not enable any roles and we will use MediaWiki core.
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 also be fast, since the target machine is local.
- MediaWiki core Selenium test run takes about 3-4 minutes on my machine.
- It takes about 6-7 minutes for selenium-Core Jenkins job to run.
- 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.
- 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
- Follow instructions at MediaWiki-Vagrant
Boot the machine
$ vagrant up
SSH into the machine
$ vagrant ssh
Go to an extension folder
$ cd /vagrant/mediawiki/extensions/EXTENSION
Install dependencies in the machine
You will need internet access for this step. Ruby 2.0 or newer is required. Third-party tools like rbenv or RVM are not required.
$ sudo apt-get install chromedriver xvfb
$ sudo gem install bundler --no-rdoc --no-ri
$ bundle install
Run the Selenium tests
$ export PATH=$PATH:/usr/lib/chromium/ $ MEDIAWIKI_ENVIRONMENT=mw-vagrant-guest bundle exec rake selenium
Exit the machine
vagrant@mediawiki-vagrant:~$ logout Connection to 127.0.0.1 closed.
halt the machine
$ vagrant suspend ==> default: Saving VM state and suspending execution...
$ vagrant halt ==> default: Attempting graceful shutdown of VM...