Stylize maintenance folder..
[mediawiki.git] / maintenance / tests / selenium / Selenium.php
blobd6cdff76ff226c8a622c7fdcb765145d2bd9198d
1 <?php
2 /**
3 * Selenium connector
4 * This is implemented as a singleton.
5 */
7 if ( !defined( 'MEDIAWIKI' ) || !defined( 'SELENIUMTEST' ) ) {
8 echo "This script cannot be run standalone";
9 exit( 1 );
12 class Selenium extends Testing_Selenium {
13 protected static $_instance = null;
14 public $isStarted = false;
16 public static function getInstance() {
17 global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost, $wgSeleniumTestsUseBrowser;
18 if ( null === self::$_instance ) {
19 self::$_instance = new self( $wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser], $wgSeleniumTestsSeleniumHost );
21 return self::$_instance;
24 public function start() {
25 global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost;
26 parent::start();
27 $this->isStarted = true;
30 public function stop() {
31 parent::stop();
32 $this->isStarted = false;
35 public function login() {
36 global $wgSeleniumTestsWikiUser, $wgSeleniumTestsWikiPassword, $wgSeleniumTestsWikiUrl;
38 $this->open( $wgSeleniumTestsWikiUrl . '/index.php?title=Special:Userlogin' );
39 $this->type( 'wpName1', $wgSeleniumTestsWikiUser );
40 $this->type( 'wpPassword1', $wgSeleniumTestsWikiPassword );
41 $this->click( "//input[@id='wpLoginAttempt']" );
42 $value = $this->doCommand( 'assertTitle', array( 'Anmeldung erfolgreich*' ) );
45 public function loadPage( $title, $action ) {
46 global $wgSeleniumTestsWikiUrl;
47 $this->open( $wgSeleniumTestsWikiUrl . '/index.php?title=' . $title . '&action=' . $action );
50 // Prevent external cloning
51 protected function __clone() { }
52 // Prevent external construction
53 // protected function __construct() {}