Selenium/How-to/Create the first test in a repository

This tutorial will assume that you are running tests from your machine, targeting MediaWiki-Docker.

For more examples see Selenium/Getting Started/Create a simple test page and Selenium/Reference/Example Code.

Simple
The minimal amount of code is just one spec file and just one page object file.

, example P8626

, example P8627

Typical
Typical patch will have a few more files. You will need these files if this is the first Selenium test in the repository.

, example P8623

, example P8624

, example P8206
 * 1) Selenium tests

For more information see https://www.mediawiki.org/wiki/Selenium/Node.js and [PATH]/mediawiki/vagrant/mediawiki/tests/selenium/README.md.


 * 1) Setup

Set up MediaWiki-Vagrant:

cd [PATH]/mediawiki/vagrant/mediawiki/extensions/[EXTENSION] vagrant up   vagrant roles enable [ROLE] vagrant provision npm install

Chromedriver has to run in one terminal window:

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


 * 1) Run all specs

In another terminal window:

npm run selenium-test


 * 1) Run specific tests

Filter by file name:

npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME]

Filter by file name and test name:

npm run selenium-test -- --spec tests/selenium/specs/[FILE-NAME] --mochaOpts.grep [TEST-NAME]

, example P8625