selenium: Update README.md file

Bug: T282237
Change-Id: Ia14349e8630e7a075e5f3ce8dea1572027309ef3
This commit is contained in:
sahil 2021-05-22 15:31:23 +05:30 committed by Sahilgrewalhere
parent 68cd3839e7
commit 2578a87e28

View file

@ -1,43 +1,21 @@
# 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
## Setup
Set up MediaWiki-Vagrant:
See https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/RelatedArticles
cd mediawiki/vagrant
vagrant up
vagrant roles enable mobilefrontend relatedarticles
vagrant provision
cd mediawiki
npm install
echo 'include_once "$IP/extensions/RelatedArticles/tests/selenium/LocalSettings.php";' >> LocalSettings.php
## Run all specs
## Start Chromedriver and run all tests
npm run selenium-test
Run both mediawiki/core and extension tests from mediawiki/core repository (usually at mediawiki/vagrant/mediawiki folder):
## Run specific tests
npm run selenium
Filter by file name:
## Start Chromedriver
npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME]
To run only some tests, you first have to start Chromedriver in one terminal tab (or window):
Filter by file name and test name:
chromedriver --url-base=wd/hub --port=4444
## Run test(s) from one file
Then, in another terminal tab (or window) run this from mediawiki/core repository (usually at mediawiki/vagrant/mediawiki folder):
./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec extensions/EXTENSION-NAME/tests/selenium/specs/FILE-NAME.js
`wdio` is a dependency of mediawiki/core that you have installed with `npm install`.
## Run specific test(s)
To run only test(s) which name contains string TEST-NAME, run this from mediawiki/core repository (usually at mediawiki/vagrant/mediawiki folder):
./node_modules/.bin/wdio tests/selenium/wdio.conf.js --spec extensions/EXTENSION-NAME/tests/selenium/specs/FILE-NAME.js --mochaOpts.grep TEST-NAME
Make sure Chromedriver is running when executing the above command.
npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME] --mochaOpts.grep [TEST-NAME]