Timo Tijhof 8dea6c2c39 selenium: Abstract test command behind 'npm run' 6 年之前
..
pageobjects 33fa8c095c Merge "Selenium: Replace nodemw with mwbot" 7 年之前
specs 33ba3cfebb Revert "selenium: add new message banner test to user spec" 7 年之前
.eslintrc.json 85f88747f2 ESLint ecmaVersion setting is not needed if env is es6 7 年之前
README.md e60074cecf WebdriverIO should be able to run Chrome headlessly 6 年之前
selenium.sh 8dea6c2c39 selenium: Abstract test command behind 'npm run' 6 年之前
wdio.conf.js 4cbd36db87 selenium: Remove Jenkins configuration file 6 年之前

README.md

Selenium tests

Prerequisites

Set up 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 file (for example page.js), you first need to spawn the chromedriver:

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

Then in another terminal:

cd tests/selenium
../../node_modules/.bin/wdio --spec specs/page.js

To run only one test (name contains string 'preferences'):

../../node_modules/.bin/wdio --spec specs/user.js --mochaOpts.grep preferences

The runner reads the config file wdio.conf.js and runs the spec listed in page.js.

The defaults in the configuration files aim are targeting 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

Links