wiki.techinc.nl/tests/selenium
Timo Tijhof 16a4d9da7b selenium: Initial version of wdio-mediawiki package
This is new package will be reusable by other repositories for
their browser tests, without having to reference the internal
selenium/pageobjects/ directory from MediaWiki core.

In addition to not requiring direct imports, it will also avoid
problems in the future by allowing the package to be versioned
and iterated upon without forcing an atomic global upgrade
(or broken master builds), everytime we change something.

See wdio-mediawiki/README for details.

Within MediaWiki core itself, the package is used using the
'file' specifier in its package.json, so that we always test
and develop using its working copy, which makes drafting and
testing changes easier.

Also misc changes to make wdio.conf easier to understand.

Bug: T193088
Change-Id: I547a7899e7a97693a93567dd763784e637433d55
2018-05-09 14:43:30 +00:00
..
pageobjects selenium: Initial version of wdio-mediawiki package 2018-05-09 14:43:30 +00:00
specs selenium: Initial version of wdio-mediawiki package 2018-05-09 14:43:30 +00:00
wdio-mediawiki selenium: Initial version of wdio-mediawiki package 2018-05-09 14:43:30 +00:00
.eslintrc.json selenium: Run wdio directly without grunt 2018-04-30 21:54:15 +00:00
README.md selenium: Initial version of wdio-mediawiki package 2018-05-09 14:43:30 +00:00
selenium.sh selenium: Run wdio directly without grunt 2018-04-30 21:54:15 +00:00
wdio.conf.js selenium: Initial version of wdio-mediawiki package 2018-05-09 14:43:30 +00:00

Selenium tests

Prerequisites

If using MediaWiki-Vagrant:

cd mediawiki/vagrant
vagrant up

Installation

cd mediawiki
npm install

Usage

npm run selenium

By default, Chrome will run in headless mode. If you want to see Chrome, set DISPLAY environment variable to any value:

DISPLAY=1 npm run selenium

To run only one test (for example specs/page.js), you first need to start Chromedriver:

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

Then, in another terminal:

npm run selenium-test -- --spec tests/selenium/specs/page.js

You can also filter specific cases, for ones that contain the string 'preferences':

npm run selenium-test -- tests/selenium/specs/user.js --mochaOpts.grep preferences

The runner reads the configuration from wdio.conf.js. The defaults target a MediaWiki-Vagrant installation on http://127.0.0.1:8080 with a user "Admin" and password "vagrant". Those settings can be overridden using environment variables:

  • MW_SERVER: to be set to the value of your $wgServer
  • MW_SCRIPT_PATH: ditto with $wgScriptPath
  • MEDIAWIKI_USER: username of an account that can create users on the wiki
  • MEDIAWIKI_PASSWORD: password for above user

Example:

MW_SERVER=http://example.org MW_SCRIPT_PATH=/dev/w npm run selenium

Further reading