Manual:Coding conventions/Selenium-Ruby

This page describes coding conventions used by Cucumber test files in MediaWiki codebase. For the list of repositories that contain the files see links section of mediawiki-selenium readme file. There are three types of files, Cucumber features files, Cucumber step definition files and page object files.

Cucumber feature files
For example file see any file in  folder of qa-browsertests repository. Feature files usually contain features and scenarios.

Required tags
Every feature or scenario in a feature file should have a site and browser specific tag.
 * Site specific tag is for example  or  . The tag specifies where the feature or scenario should run. This convention is currently used in most places.
 * Browser specific tag is for example  or  . The tag specifies which browser should be used to run the feature or scenario. This convention is currently not used. At the moment we tag features or scenarios if they are known to fail with specific browser, for example.

Optional tags
Some features or scenarios can have an optional tag.
 * If the feature or scenario requires the user to log in, it should have  tag. This convention is currently used in most places.


 * If the feature or scenario runs fine on a clean wiki, it should be tagged . This convention is currently not used. At the moment we tag features or scenarios that are known to fail on a clean wiki with.
 * If the feature or scenario requires custom browser configuration, it should be tagged . This convention is currently not used. At the moment we tag features or scenarios that need custom browser configuration with   tag in UniversalLanguageSelector repository and with   tag in MobileFrontend repository.

Cucumber step definition files
For example file see any file in   folder of qa-browsertests repository. Step definition files usually contain,   and   steps.

Grouped By Type
Steps should be grouped by type. and  steps should be grouped in one group,   steps should be grouped separately. Inside the group, steps should be sorted alphabetically by step name. This convention is currently not used. At the moment we do not combine  and   steps in one group.

Alphabetically Sorted
Cucumber step definitions should be sorted alphabetically. This is how a definition looks like:

Example (from login_steps.rb):