7db805a1024272f850affe506b11c39c07d89183
4 * This is implemented as a singleton.
7 class Selenium
extends Testing_Selenium
{
8 protected static $_instance = null;
9 public $isStarted = false;
11 public static function getInstance() {
12 global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost, $wgSeleniumTestsUseBrowser;
13 global $wgSeleniumServerPort;
14 if ( null === self
::$_instance ) {
15 self
::$_instance = new self( $wgSeleniumTestsBrowsers[$wgSeleniumTestsUseBrowser],
17 $wgSeleniumTestsSeleniumHost,
18 $wgSeleniumServerPort );
20 return self
::$_instance;
23 public function start() {
24 global $wgSeleniumTestsBrowsers, $wgSeleniumTestsSeleniumHost;
26 $this->isStarted
= true;
29 public function stop() {
31 $this->isStarted
= false;
34 static function getBaseUrl() {
35 global $wgSeleniumTestsWikiUrl, $wgServer, $wgScriptPath;
36 if ( $wgSeleniumTestsWikiUrl ) {
37 return $wgSeleniumTestsWikiUrl;
39 return $wgServer . $wgScriptPath;
43 public function login() {
44 global $wgSeleniumTestsWikiUser, $wgSeleniumTestsWikiPassword;
46 $this->open( self
::getBaseUrl() . '/index.php?title=Special:Userlogin' );
47 $this->type( 'wpName1', $wgSeleniumTestsWikiUser );
48 $this->type( 'wpPassword1', $wgSeleniumTestsWikiPassword );
49 $this->click( "//input[@id='wpLoginAttempt']" );
50 $value = $this->doCommand( 'assertTitle', array( 'Login successful*' ) );
53 public function loadPage( $title, $action ) {
54 $this->open( self
::getBaseUrl() . '/index.php?title=' . $title . '&action=' . $action );
57 // Prevent external cloning
58 protected function __clone() { }
59 // Prevent external construction
60 // protected function __construct() {}