For this example, we will not enable any roles and we will use MediaWiki core.
- While the tests are running, you can continue using your machine as usual, because browser is running inside a virtual machine at Sauce Labs.
- Debugging failed tests will be easier, since you will see the browser, logs, screenshots and video of the test run.
- You do not have to have Chrome installed.
- You can run tests using any operating system and browser combination that Sauce Labs supports.
- You are probably already familiar with MediaWiki-Vagrant and have it installed.
- The tests will be slower since the browser is running on a remote machine. MediaWiki core Selenium test run takes about 5 minutes on my machine. (As of September 2019.)
- You will need internet connection while running the tests.
- 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, Selenium and their dependencies on your machine.
Set up MediaWiki-VagrantEdit
- Follow instructions at MediaWiki-Vagrant.
Boot the machineEdit
$ vagrant up
$ cd mediawiki
Depending on your operating system, installing dependencies will be different.
- Install Node.js.
- Install required npm packages.
$ npm ci
Sauce Connect ProxyEdit
- Install Sauce Connect Proxy.
Create Sauce Labs account if you do not have one.
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 (
~/.zshrc...) which means the variables are always available from any terminal session:
export DISPLAY=1 export SAUCE_USERNAME=sauce_username export SAUCE_ACCESS_KEY=sauce_access_key
sauce_username is your Sauce Labs username.
sauce_access_key is Access Key from Sauce Labs My Account page (
https://app.saucelabs.com/users/sauce_username as of September 2019).
Run the Selenium testsEdit
Run these commands in two terminal windows or tabs.
$ sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY
$ npm run selenium-test
halt the machineEdit
$ vagrant suspend ==> default: Saving VM state and suspending execution...
$ vagrant halt ==> default: Attempting graceful shutdown of VM...