r70320 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70319‎ | r70320 | r70321 >
Date:08:04, 2 August 2010
Author:mglaser
Status:ok
Tags:
Comment:
* log browser used
* improve automated login of test user
credits to priyanka dhanda
Modified paths:
  • /trunk/phase3/maintenance/tests/selenium/Selenium.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/selenium/Selenium.php
@@ -10,8 +10,10 @@
1111
1212 public static function getInstance() {
1313 global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost, $wgSeleniumTestsUseBrowser;
14 - global $wgSeleniumServerPort;
 14+ global $wgSeleniumServerPort, $wgSeleniumLogger;
 15+
1516 if ( null === self::$_instance ) {
 17+ $wgSeleniumLogger->write( "Browser: " . $wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser] );
1618 self::$_instance = new self( $wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser],
1719 self::getBaseUrl(),
1820 $wgSeleniumTestsSeleniumHost,
@@ -46,13 +48,27 @@
4749 $this->type( 'wpName1', $wgSeleniumTestsWikiUser );
4850 $this->type( 'wpPassword1', $wgSeleniumTestsWikiPassword );
4951 $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+
5159 }
5260
5361 public function loadPage( $title, $action ) {
5462 $this->open( self::getBaseUrl() . '/index.php?title=' . $title . '&action=' . $action );
5563 }
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+
5773 // Prevent external cloning
5874 protected function __clone() { }
5975 // Prevent external construction

Status & tagging log