Selenium/Ruby/Shared features

This is a list of features provided by the RubyGem that are available to all browser tests in all repos. See Quality Assurance/Browser testing/Writing tests for an introduction to writing tests.

Login
Logs the user in on the wiki specified by the environment variable MEDIAWIKI_URL

Usage
In any Scenario in any Feature, just use

and the shared login step will use the environment variables MEDIAWIKI_USER and MEDIAWIKI_PASSWORD to login at the target wiki.

Random page
Sends the script to a random page in the target wiki

Usage
In any Scenario in any Feature, just use

Reset preferences
Resets all of the test user's preferences to default settings.

Usage
In any Scenario in any Feature, just use

ResourceLoader errors
After loading any page, this step will check for ResourceLoader errors and report any modules that have errors and any modules that are missing.

Usage
In any Scenario in any Feature, just use

Upload file
Steps to upload valid or invalid media files via the shared interface in both Firefox and Chrome

Usage
In any Scenario in any Feature, just use

to upload a valid PNG image file

and

to upload an invalid empty file

Create page at run time via API
Creates a page with particular title and text in the target wiki at runtime.

In the target wiki:


 * if no page with this title exists, the page will be created with the specified content
 * if a page with this title exists but the contents of the page differ from what is in the API call, the existing page will be updated with the contents of the API call by means of a normal revision, which will appear in the history of the page.
 * if a page with this title exists and the contents of the page are identical to what is in the API call, the existing page is not changed in any way, and no additional revisions are created. This is a no-op.

Usage
In the steps for any Scenario do

Note the creative possibilities:


 * to create a page in the target wiki with a quasi-unique title that the running Scenario will be able to find and use in the course of the test:


 * to guarantee that a particular page in the target wiki will have particular content, and then navigate to that page:

Protect
sets the level of protection to

edit=sysop|move=sysop