Fixed spacing in actions/cache/filebackend/filerepo/job folder
[mediawiki.git] / tests / selenium / SeleniumTestSuite.php
blob8c21f21c69b0642cd7e79fe374fae657b9d385ca
1 <?php
3 abstract class SeleniumTestSuite extends PHPUnit_Framework_TestSuite {
4 private $selenium;
5 private $isSetUp = false;
6 private $loginBeforeTests = true;
7 private $triggerClientTestResources = true;
9 // Do not add line break after test output
10 const CONTINUE_LINE = 1;
11 const RESULT_OK = 2;
12 const RESULT_ERROR = 3;
14 abstract public function addTests();
16 public function setUp() {
17 // Hack because because PHPUnit version 3.0.6 which is on prototype does not
18 // run setUp as part of TestSuite::run
19 if ( $this->isSetUp ) {
20 return;
22 $this->isSetUp = true;
23 $this->selenium = Selenium::getInstance();
24 $this->selenium->start();
25 if ( $this->triggerClientTestResources ) {
26 $this->selenium->open( $this->selenium->getUrl() . '/index.php?setupTestSuite=' . $this->getName() );
27 //wait a little longer for the db operation
28 $this->selenium->waitForPageToLoad( 6000 );
30 if ( $this->loginBeforeTests ) {
31 $this->login();
35 public function tearDown() {
36 if ( $this->triggerClientTestResources ) {
37 $this->selenium->open( $this->selenium->getUrl() . '/index.php?clearTestSuite=' . $this->getName() );
39 $this->selenium->stop();
42 public function login() {
43 $this->selenium->login();
46 public function loadPage( $title, $action ) {
47 $this->selenium->loadPage( $title, $action );
50 protected function setLoginBeforeTests( $loginBeforeTests = true ) {
51 $this->loginBeforeTests = $loginBeforeTests;
54 protected function setTriggerClientTestResources( $triggerClientTestResources = true ) {
55 $this->triggerClientTestResources = $triggerClientTestResources;