Selenium: update and simplify README

Bug: T210726
Change-Id: I3dc028c36b98de68351ca754233a5bc2994e0f03
This commit is contained in:
Željko Filipin 2019-03-26 15:35:11 +01:00
parent a0e0cffe48
commit c054b6ddb0

View file

@ -1,42 +1,40 @@
# Selenium tests
Please see tests/selenium/README.md file in mediawiki/core repository, usually at mediawiki/vagrant/mediawiki folder.
For more information see https://www.mediawiki.org/wiki/Selenium/Node.js and [PATH]/mediawiki/vagrant/mediawiki/tests/selenium/README.md.
## Setup
Set up MediaWiki-Vagrant:
cd mediawiki/vagrant
cd [PATH]/mediawiki/vagrant/mediawiki/extensions/Echo
vagrant up
vagrant roles enable echo
vagrant provision
cd mediawiki
npm install
## Start Chromedriver and run all tests
Run both mediawiki/core and extension tests from mediawiki/core repository (usually at mediawiki/vagrant/mediawiki folder):
npm run selenium
## Start Chromedriver
To run only some tests, you first have to start Chromedriver in one terminal tab (or window):
Chromedriver has to run in one terminal window:
chromedriver --url-base=wd/hub --port=4444
## Run test(s) from one file
## Run all specs
Then, in another terminal tab (or window) run this from mediawiki/core repository (usually at mediawiki/vagrant/mediawiki folder):
In another terminal window:
./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec extensions/EXTENSION-NAME/tests/selenium/specs/FILE-NAME.js
npm run selenium-test
`wdio` is a dependency of mediawiki/core that you have installed with `npm install`.
## [T171963](https://phabricator.wikimedia.org/T171963) `No active login attempt is in progress for your session`
## Run specific test(s)
If you get this error message when logging in at `127.0.0.1:8080`, the workaround
is to log in at `dev.wiki.local.wmftest.net:8080`
To run only test(s) which name contains string TEST-NAME, run this from mediawiki/core repository (usually at mediawiki/vagrant/mediawiki folder):
MW_SERVER=http://dev.wiki.local.wmftest.net:8080 npm run selenium-test
./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec extensions/EXTENSION-NAME/tests/selenium/specs/FILE-NAME.js --mochaOpts.grep TEST-NAME
## Run specific tests
Make sure Chromedriver is running when executing the above command.
Filter by file name:
npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME].js
Filter by file name and test name:
npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME.js] --mochaOpts.grep [TEST-NAME]