Index: trunk/phase3/maintenance/tests/selenium/Selenium.php |
— | — | @@ -10,8 +10,10 @@ |
11 | 11 | |
12 | 12 | public static function getInstance() { |
13 | 13 | global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost, $wgSeleniumTestsUseBrowser; |
14 | | - global $wgSeleniumServerPort; |
| 14 | + global $wgSeleniumServerPort, $wgSeleniumLogger; |
| 15 | + |
15 | 16 | if ( null === self::$_instance ) { |
| 17 | + $wgSeleniumLogger->write( "Browser: " . $wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser] ); |
16 | 18 | self::$_instance = new self( $wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser], |
17 | 19 | self::getBaseUrl(), |
18 | 20 | $wgSeleniumTestsSeleniumHost, |
— | — | @@ -46,13 +48,27 @@ |
47 | 49 | $this->type( 'wpName1', $wgSeleniumTestsWikiUser ); |
48 | 50 | $this->type( 'wpPassword1', $wgSeleniumTestsWikiPassword ); |
49 | 51 | $this->click( "//input[@id='wpLoginAttempt']" ); |
50 | | - $value = $this->doCommand( 'assertTitle', array( 'Login successful*' ) ); |
| 52 | + $this->waitForPageToLoad(5000); |
| 53 | + //after login we redirect to the main page. So check whether the "Prefernces" top menu item exists |
| 54 | + $value = $this->isElementPresent( "//li[@id='pt-preferences']" ); |
| 55 | + if ( $value != true ) { |
| 56 | + throw new Testing_Selenium_Exception( "Login Failed" ); |
| 57 | + } |
| 58 | + |
51 | 59 | } |
52 | 60 | |
53 | 61 | public function loadPage( $title, $action ) { |
54 | 62 | $this->open( self::getBaseUrl() . '/index.php?title=' . $title . '&action=' . $action ); |
55 | 63 | } |
56 | | - |
| 64 | + |
| 65 | + /* |
| 66 | + * Log to console or html depending on the value of $wgSeleniumTestsRunMode |
| 67 | + */ |
| 68 | + public function log( $message ) { |
| 69 | + global $wgSeleniumLogger; |
| 70 | + $wgSeleniumLogger->write( $message ); |
| 71 | + } |
| 72 | + |
57 | 73 | // Prevent external cloning |
58 | 74 | protected function __clone() { } |
59 | 75 | // Prevent external construction |