Index: trunk/phase3/maintenance/tests/RunSeleniumTests.php |
— | — | @@ -51,7 +51,8 @@ |
52 | 52 | $this->addOption( 'verbose', 'Be noisier.' ); |
53 | 53 | $this->addOption( 'startserver', 'Start Selenium Server (on localhost) before the run.' ); |
54 | 54 | $this->addOption( 'stopserver', 'Stop Selenium Server (on localhost) after the run.' ); |
55 | | - $this->addOption( 'jUnitLogFile', 'Log results in a specified JUnit log file.', false, true ); |
| 55 | + $this->addOption( 'jUnitLogFile', 'Log results in a specified JUnit log file. Default: empty', false, true ); |
| 56 | + $this->addOption( 'runAgainstGrid', 'The test will be run against a Selenium Grid. Default: false.', false, true ); |
56 | 57 | $this->deleteOption( 'dbpass' ); |
57 | 58 | $this->deleteOption( 'dbuser' ); |
58 | 59 | $this->deleteOption( 'globals' ); |
— | — | @@ -180,10 +181,12 @@ |
181 | 182 | if ( !isset( $seleniumSettings['userPassword'] ) ) $seleniumSettings['userPassword'] = ''; |
182 | 183 | if ( !isset( $seleniumSettings['testBrowser'] ) ) $seleniumSettings['testBrowser'] = 'firefox'; |
183 | 184 | if ( !isset( $seleniumSettings['jUnitLogFile'] ) ) $seleniumSettings['jUnitLogFile'] = false; |
| 185 | + if ( !isset( $seleniumSettings['runAgainstGrid'] ) ) $seleniumSettings['runAgainstGrid'] = false; |
184 | 186 | |
185 | 187 | // Setup Selenium class |
186 | 188 | $this->selenium = new Selenium( ); |
187 | 189 | $this->selenium->setAvailableBrowsers( $seleniumBrowsers ); |
| 190 | + $this->selenium->setRunAgainstGrid( $this->getOption( 'runAgainstGrid', $seleniumSettings['runAgainstGrid'] ) ); |
188 | 191 | $this->selenium->setUrl( $this->getOption( 'wikiUrl', $seleniumSettings['wikiUrl'] ) ); |
189 | 192 | $this->selenium->setBrowser( $this->getOption( 'testBrowser', $seleniumSettings['testBrowser'] ) ); |
190 | 193 | $this->selenium->setPort( $this->getOption( 'port', $seleniumSettings['port'] ) ); |
Index: trunk/phase3/maintenance/tests/selenium/Selenium.php |
— | — | @@ -22,6 +22,7 @@ |
23 | 23 | protected $timeout = 30000; |
24 | 24 | protected $verbose; |
25 | 25 | protected $junitlogfile; //processed by phpUnderControl |
| 26 | + protected $runagainstgrid = false; |
26 | 27 | |
27 | 28 | /** |
28 | 29 | * @todo this shouldn't have to be static |
— | — | @@ -145,7 +146,15 @@ |
146 | 147 | return $this->junitlogfile; |
147 | 148 | } |
148 | 149 | |
| 150 | + public function setRunAgainstGrid( $runagainstgrid ) { |
| 151 | + $this->runagainstgrid = $runagainstgrid; |
| 152 | + } |
| 153 | + |
149 | 154 | public function setBrowser( $b ) { |
| 155 | + if ($this->runagainstgrid) { |
| 156 | + $this->browser = $b; |
| 157 | + return true; |
| 158 | + } |
150 | 159 | if ( !isset( $this->browsers[$b] ) ) { |
151 | 160 | throw new MWException( "Invalid Browser: $b.\n" ); |
152 | 161 | } |
Index: trunk/phase3/maintenance/tests/selenium/SeleniumConfig.php |
— | — | @@ -49,6 +49,7 @@ |
50 | 50 | $seleniumSettings['stopserver'] = $configArray['SeleniumSettings']['stopserver']; |
51 | 51 | $seleniumSettings['seleniumserverexecpath'] = $configArray['SeleniumSettings']['seleniumserverexecpath']; |
52 | 52 | $seleniumSettings['jUnitLogFile'] = $configArray['SeleniumSettings']['jUnitLogFile']; |
| 53 | + $seleniumSettings['runAgainstGrid'] = $configArray['SeleniumSettings']['runAgainstGrid']; |
53 | 54 | |
54 | 55 | wfRestoreWarnings(); |
55 | 56 | } |