Extension:Page Forms/Testing

Running Cucumber tests in Semantic Forms
To run Cucumber tests for the Semantic Forms extension follow these steps:

Temporarily: obtain the Cucumber tests equipped SF codebase
This step is necessary until the Cucumber tests have been integrated upstream.

git clone https://github.com/LinuxCompetenceCenter/mediawiki-extensions-SemanticForms.git

Install Firefox
The Cucumber tests require Firefox, and, if run in a VM, ssh forwarding settings (see e.g. for Vagrant) as for the time being they're not headless.

Note: You might need to investigate the correct combination of selenium-webdriver and your version of Firefox, although the newest versions of both should work together.

Install Ruby and Bundler

 * Install Ruby
 * Install Bundler

Install the main test form page
For example, if your SMW runs on a virtual machine at "http://localhost:20011" and your $wgScriptPath is "/w", then in your browser:


 * 1) Log into SMW as user "WikiSysop" (enjoying API write permissions).
 * 2) Then run:

http://localhost:20011/w/extensions/SemanticForms/tests/browser/features/support/inject_test_meta_pages.php

Your SMW should now have created the page "Form:Main_Test_Form".

Install necessary Ruby gems
w/extensions/SemanticForms$ gem install bundler w/extensions/SemanticForms$ bundle install

Run the Cucumber tests in Semantic Forms
w/extensions/SemanticForms/tests/browser$ bundle exec cucumber -q

Cucumber Help

Loopback addresses
The test server's loopback addresses are expected to be mapped to the hostname "localhost".

$wgScriptPath
$wgScriptPath

The script path is "reverse-detected" by the env.rb file.

$wgArticlePath
$wgArticlePath

The env.rb queries the article path by https://www.mediawiki.org/wiki/API:Siteinfo.

Which form interactions are tested?
See main.feature_part and form_elements.feature_part.

How is the main test form declared?
See inject_test_meta_pages.php.

Work in progress

 * 1) Add more expectations to be met in terms of what ends up in the templates instantiated.
 * 2) Add an option to run the Cucumber tests headless.
 * 3) Speed up the xpath location processes.
 * 4) Add more form inputs. (See Allowed_input_types_for_data_types and Extension:Semantic_Forms_Inputs)
 * 5) Have the main test form declaration be injected into the test SMW automatically.