Selenium/Ruby/Shared features

This is a list of features that are available to all browser tests in all repos.

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.

Usage
In the steps for any Scenario do

Given(/^I create some page with some content$/) do on(APIPage).create "page title", "page contents" end

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:

Given(/^I create a random page using the API$/) do on(APIPage).create @random_string, @random_string end


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

Given(/^I go to a page that has references$/) do wikitext = "MobileFrontend is a MediaWiki extension.