From: Markus Glaser Date: Sat, 23 Oct 2010 15:52:12 +0000 (+0000) Subject: added settings to run tests against a selenium grid X-Git-Tag: 1.31.0-rc.0~34365 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=bfc028facbcb96abeb04cc2a395813bdd56983b1;p=lhc%2Fweb%2Fwiklou.git added settings to run tests against a selenium grid --- diff --git a/maintenance/tests/RunSeleniumTests.php b/maintenance/tests/RunSeleniumTests.php index e705e61eaa..2ff72a7795 100644 --- a/maintenance/tests/RunSeleniumTests.php +++ b/maintenance/tests/RunSeleniumTests.php @@ -51,7 +51,8 @@ class SeleniumTester extends Maintenance { $this->addOption( 'verbose', 'Be noisier.' ); $this->addOption( 'startserver', 'Start Selenium Server (on localhost) before the run.' ); $this->addOption( 'stopserver', 'Stop Selenium Server (on localhost) after the run.' ); - $this->addOption( 'jUnitLogFile', 'Log results in a specified JUnit log file.', false, true ); + $this->addOption( 'jUnitLogFile', 'Log results in a specified JUnit log file. Default: empty', false, true ); + $this->addOption( 'runAgainstGrid', 'The test will be run against a Selenium Grid. Default: false.', false, true ); $this->deleteOption( 'dbpass' ); $this->deleteOption( 'dbuser' ); $this->deleteOption( 'globals' ); @@ -180,10 +181,12 @@ class SeleniumTester extends Maintenance { if ( !isset( $seleniumSettings['userPassword'] ) ) $seleniumSettings['userPassword'] = ''; if ( !isset( $seleniumSettings['testBrowser'] ) ) $seleniumSettings['testBrowser'] = 'firefox'; if ( !isset( $seleniumSettings['jUnitLogFile'] ) ) $seleniumSettings['jUnitLogFile'] = false; + if ( !isset( $seleniumSettings['runAgainstGrid'] ) ) $seleniumSettings['runAgainstGrid'] = false; // Setup Selenium class $this->selenium = new Selenium( ); $this->selenium->setAvailableBrowsers( $seleniumBrowsers ); + $this->selenium->setRunAgainstGrid( $this->getOption( 'runAgainstGrid', $seleniumSettings['runAgainstGrid'] ) ); $this->selenium->setUrl( $this->getOption( 'wikiUrl', $seleniumSettings['wikiUrl'] ) ); $this->selenium->setBrowser( $this->getOption( 'testBrowser', $seleniumSettings['testBrowser'] ) ); $this->selenium->setPort( $this->getOption( 'port', $seleniumSettings['port'] ) ); diff --git a/maintenance/tests/selenium/Selenium.php b/maintenance/tests/selenium/Selenium.php index 25f1037716..662e282e41 100644 --- a/maintenance/tests/selenium/Selenium.php +++ b/maintenance/tests/selenium/Selenium.php @@ -22,6 +22,7 @@ class Selenium { protected $timeout = 30000; protected $verbose; protected $junitlogfile; //processed by phpUnderControl + protected $runagainstgrid = false; /** * @todo this shouldn't have to be static @@ -145,7 +146,15 @@ class Selenium { return $this->junitlogfile; } + public function setRunAgainstGrid( $runagainstgrid ) { + $this->runagainstgrid = $runagainstgrid; + } + public function setBrowser( $b ) { + if ($this->runagainstgrid) { + $this->browser = $b; + return true; + } if ( !isset( $this->browsers[$b] ) ) { throw new MWException( "Invalid Browser: $b.\n" ); } diff --git a/maintenance/tests/selenium/SeleniumConfig.php b/maintenance/tests/selenium/SeleniumConfig.php index a7ceca5b60..ca438a8832 100644 --- a/maintenance/tests/selenium/SeleniumConfig.php +++ b/maintenance/tests/selenium/SeleniumConfig.php @@ -49,6 +49,7 @@ class SeleniumConfig { $seleniumSettings['stopserver'] = $configArray['SeleniumSettings']['stopserver']; $seleniumSettings['seleniumserverexecpath'] = $configArray['SeleniumSettings']['seleniumserverexecpath']; $seleniumSettings['jUnitLogFile'] = $configArray['SeleniumSettings']['jUnitLogFile']; + $seleniumSettings['runAgainstGrid'] = $configArray['SeleniumSettings']['runAgainstGrid']; wfRestoreWarnings(); }