This is detailed information for setting up the Selenium framework.
Enable Selenium on your test Wiki[edit]Set the following in your test wiki's LocalSettings.php:
$wgEnableSelenium = true;
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.
php RunSeleniumTests.php --seleniumConfig=../../selenium_settings.ini Using Selenium Configuration file: ../../selenium_settings.ini ....
$wgSeleniumConfigFile = $IP . '/selenium_settings.ini';
php RunSeleniumTests.php No command line configuration file or configuration hook found. ....Sample configuration to run on a local machine[edit]
A sample configuration is checked into maintenance/tests/selenium/selenium_settings.ini.sample
[SeleniumSettings] ; Set up the available browsers that Selenium can control. browsers[firefox] = "*firefox" browsers[iexplorer] = "*iexploreproxy" browsers[chrome] = "*chrome" ; 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 ; 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. seleniumserverexecpath = "/opt/local/selenium-remote-control-1.0.3/selenium-server-1.0.3/selenium-server.jar" [SeleniumTests] testSuite[SimpleSeleniumTestSuite] = "maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php" testSuite[PagedTiffHandlerSeleniumTestSuite] = "extensions/PagedTiffHandler/selenium/PagedTiffHandlerTestSuite.php"
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"
testBrowser
value.wikiUrl
.runAgainstGrid
is set to true
.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[edit]
Another way to configure your selenium test instance is through a Hook - SeleniumSettings.
$wgHooks['SeleniumSettings'][] = 'MyCustomSeleniumTestConfigStatic::getSeleniumSettings';
You will need to add MyCustomSeleniumTestConfigStatic to the AutoLoader or your LocalSettings.php.
The 3 required parameters passed by reference are:
array ( 'host' => '<selenium server host>', 'port' => '<selenium server port>', 'wikiUrl' => '<the test wiki url>', 'username' => '<the username if the tests require login>', 'userPassword' => '<the user password if the tests require login>', 'testBrowser' => '<the browser to use for testing>', )
array ( 'firefox' => '*firefox', 'iexplorer' => '*iexploreproxy', 'chrome' => '*chrome', )
array ( 'SimpleSeleniumTestSuite' => 'maintenance/tests/selenium/SimpleSeleniumTestSuite.php', 'MyExtensionTestSuite' => 'extensions/myextension/tests/selenium/MyExtensionTestSuite.php', )
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4