Selenium/PHP/Selenium Configuration

This is detailed information for setting up the Selenium framework.

Enable Selenium on your test Wiki
Set the following in your test wiki's LocalSettings.php:

The tests runner is a maintenance script maintenance/tests/RunSeleniumTests.php The next sections cover how you can tell the test runner about your selenium environment.

Configure Selenium using a configuration file
php RunSeleniumTests.php --seleniumConfig=../../selenium_settings.ini Using Selenium Configuration file: ../../selenium_settings.ini .... php RunSeleniumTests.php No command line configuration file or configuration hook found. ....
 * The easiest way is to point the test runner to your selenium configuration file through the command line option.
 * If the --seleniumConfig option is not found and in the absense of a hook, it looks for a global variable $wgSeleniumConfigFile that you can set in your LocalSettings.php

Sample configuration to run on a local machine
A sample configuration is checked into maintenance/tests/selenium/selenium_settings.ini.sample [SeleniumSettings]

browsers[firefox] 	= "*firefox" browsers[iexplorer]    = "*iexploreproxy" browsers[chrome] 	= "*chrome"
 * Set up the available browsers that Selenium can control.


 * The simple configurations above usually work on Linux, but Windows and
 * Mac OS X hosts may need to specify a full path:
 * browsers[firefox] = "*firefox /Applications/Firefox.app/Contents/MacOS/firefox-bin"
 * browsers[firefox] = "*firefox C:\Program Files\Mozilla Firefox\firefox.exe"

host 				= "localhost" port 				= "4444" wikiUrl 			= "http://localhost/deployment" username 			= "wikiuser" userPassword 		       = "wikipass" testBrowser 		       = "firefox" startserver			= stopserver			= jUnitLogFile		       = runAgainstGrid	               = false

seleniumserverexecpath = "/opt/local/selenium-remote-control-1.0.3/selenium-server-1.0.3/selenium-server.jar"
 * To let the test runner start and stop the selenium server, it needs the full
 * path to selenium-server.jar from the selenium-remote-control package.

[SeleniumTests]

testSuite[SimpleSeleniumTestSuite] = "maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php" testSuite[PagedTiffHandlerSeleniumTestSuite] = "extensions/PagedTiffHandler/selenium/PagedTiffHandlerTestSuite.php"


 * Hint: seleniumserverexecpath not yet implemented for Windows.

Sample configuration to run against a selenium grid
A sample configuration is checked into maintenance/tests/selenium/selenium_settings_grid.ini.sample

[SeleniumSettings]

host			= "grid.tesla.usability.wikimedia.org" port			= "4444" wikiUrl			= "http://208.80.152.253:5001" username		= "wikiuser" userPassword	       = "wikipass" testBrowser		= "Safari on OS X Snow Leopard" runAgainstGrid	       = true

[testSuite]

SimpleSeleniumTestSuite	= "maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php"


 * You don't need to define any browsers as this is done for you by the grid.
 * Available environments can be found at the grid console
 * Use the name under "Environment" as  value.
 * Use host:port as.
 * Make sure the option  is set to.

Configure Selenium using command line parameters (This may go away soon)
You can override parameters from the configuration file or the hook function using command line paranteres: Usage: php RunSeleniumTests.php [--conf|--help|--host|--list-browsers|--port|--quiet|--seleniumConfig |--testBrowser|--userPassword|--username|--verbose|--wikiUrl]

conf : Location of LocalSettings.php, if not default help : Display this help message host : Host selenium server. Default: $wgServer. $wgScriptPath list-browsers : List the available browsers. port : Port used by selenium server. Default: 4444 quiet : Whether to supress non-error output seleniumConfig : Location of the selenium config file. Default: empty testBrowser : The browser he used during testing. Default: firefox userPassword : The login password for running tests. Default: empty username : The login username for sunning tests. Default: empty verbose : Be noisier. wikiUrl : The Mediawiki installation to point to. Default: http://localhost For example: php RunSeleniumTests.php --wikiUrl='http://localhost/deployment' --username='WikiSysop' --userPassword='xxxxxx'

Configure Selenium using a Hook function
Another way to configure your selenium test instance is through a Hook - SeleniumSettings. You will need to add MyCustomSeleniumTestConfigStatic to the AutoLoader or your LocalSettings.php.

The 3 required parameters passed by reference are:
 * $seleniumSettings: An array containing the selenium configuration parameters as key value pairs> Possible keys are:
 * $seleniumBrowsers: Browsers available to the selenium server. For example:
 * $seleniumTestSuites: Path to the test suites that the test runner will run. For example: