Selenium/Getting Started/Create a simple test

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

MediaWiki Core
Let's write a new simple test for MediaWiki core. For example,  is one of the rare pages that does not have   link. Let's write a test to check that.

Code
Following code is in Gerrit (345378).

A new test file should be created:

A new page object file should be created:

Output
To run all tests, run this from MediaWiki core folder:

To run just the new test file, run this from MediaWiki core folder, in two separate terminal tabs or windows:

Typical patch
The above example is minimal amount of code for a Selenium test in an extension. The minimal amount of code is just one spec file (example: ) and just one page object file (example:  ).

Typical patch will have a few more files:


 * (example: P8623)
 * (example: P8624)
 * (example: P8206)
 * (example: P8625)

MediaWiki Extension
Let's write a new simple test for a MediaWiki extension. For example, Math. This example is available as 5 and 17 minute videos. For more examples see Write tests section of Selenium/Node.js page.

Code
Following code is in Gerrit (346982).

A new test file should be created:

A new page object file should be created:

Output
To run all tests, run this from MediaWiki core folder:

To run just the new test file, run this from MediaWiki core folder, in two separate terminal tabs or windows:

Limitations / Known Issues
As noted in T150435, there is no Parsoid service available within Wikimedia Continuous Integration stack so it is not possible to write any tests which rely on a working VisualEditor instance.