From: Markus Glaser Date: Mon, 2 Aug 2010 08:04:16 +0000 (+0000) Subject: * log browser used X-Git-Tag: 1.31.0-rc.0~35787 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=67ce8f068732e2e09c7872a47340d709596f1b71;p=lhc%2Fweb%2Fwiklou.git * log browser used * improve automated login of test user credits to priyanka dhanda --- diff --git a/maintenance/tests/selenium/Selenium.php b/maintenance/tests/selenium/Selenium.php index 688a69f51b..4bd54ba974 100644 --- a/maintenance/tests/selenium/Selenium.php +++ b/maintenance/tests/selenium/Selenium.php @@ -10,8 +10,10 @@ class Selenium extends Testing_Selenium { public static function getInstance() { global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost, $wgSeleniumTestsUseBrowser; - global $wgSeleniumServerPort; + global $wgSeleniumServerPort, $wgSeleniumLogger; + if ( null === self::$_instance ) { + $wgSeleniumLogger->write( "Browser: " . $wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser] ); self::$_instance = new self( $wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser], self::getBaseUrl(), $wgSeleniumTestsSeleniumHost, @@ -46,13 +48,27 @@ class Selenium extends Testing_Selenium { $this->type( 'wpName1', $wgSeleniumTestsWikiUser ); $this->type( 'wpPassword1', $wgSeleniumTestsWikiPassword ); $this->click( "//input[@id='wpLoginAttempt']" ); - $value = $this->doCommand( 'assertTitle', array( 'Login successful*' ) ); + $this->waitForPageToLoad(5000); + //after login we redirect to the main page. So check whether the "Prefernces" top menu item exists + $value = $this->isElementPresent( "//li[@id='pt-preferences']" ); + if ( $value != true ) { + throw new Testing_Selenium_Exception( "Login Failed" ); + } + } public function loadPage( $title, $action ) { $this->open( self::getBaseUrl() . '/index.php?title=' . $title . '&action=' . $action ); } - + + /* + * Log to console or html depending on the value of $wgSeleniumTestsRunMode + */ + public function log( $message ) { + global $wgSeleniumLogger; + $wgSeleniumLogger->write( $message ); + } + // Prevent external cloning protected function __clone() { } // Prevent external construction