summaryrefslogtreecommitdiff
path: root/tests/selenium/SeleniumTestSuite.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
commit91e194556c52d2f354344f930419eef2dd6267f0 (patch)
tree0cd12490d3cd3499274017c9b799d0f738d3719e /tests/selenium/SeleniumTestSuite.php
parent08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (diff)
Update to MediaWiki 1.21.2
Diffstat (limited to 'tests/selenium/SeleniumTestSuite.php')
-rw-r--r--tests/selenium/SeleniumTestSuite.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/selenium/SeleniumTestSuite.php b/tests/selenium/SeleniumTestSuite.php
new file mode 100644
index 00000000..8c21f21c
--- /dev/null
+++ b/tests/selenium/SeleniumTestSuite.php
@@ -0,0 +1,57 @@
+<?php
+
+abstract class SeleniumTestSuite extends PHPUnit_Framework_TestSuite {
+ private $selenium;
+ private $isSetUp = false;
+ private $loginBeforeTests = true;
+ private $triggerClientTestResources = true;
+
+ // Do not add line break after test output
+ const CONTINUE_LINE = 1;
+ const RESULT_OK = 2;
+ const RESULT_ERROR = 3;
+
+ abstract public function addTests();
+
+ public function setUp() {
+ // Hack because because PHPUnit version 3.0.6 which is on prototype does not
+ // run setUp as part of TestSuite::run
+ if ( $this->isSetUp ) {
+ return;
+ }
+ $this->isSetUp = true;
+ $this->selenium = Selenium::getInstance();
+ $this->selenium->start();
+ if ( $this->triggerClientTestResources ) {
+ $this->selenium->open( $this->selenium->getUrl() . '/index.php?setupTestSuite=' . $this->getName() );
+ //wait a little longer for the db operation
+ $this->selenium->waitForPageToLoad( 6000 );
+ }
+ if ( $this->loginBeforeTests ) {
+ $this->login();
+ }
+ }
+
+ public function tearDown() {
+ if ( $this->triggerClientTestResources ) {
+ $this->selenium->open( $this->selenium->getUrl() . '/index.php?clearTestSuite=' . $this->getName() );
+ }
+ $this->selenium->stop();
+ }
+
+ public function login() {
+ $this->selenium->login();
+ }
+
+ public function loadPage( $title, $action ) {
+ $this->selenium->loadPage( $title, $action );
+ }
+
+ protected function setLoginBeforeTests( $loginBeforeTests = true ) {
+ $this->loginBeforeTests = $loginBeforeTests;
+ }
+
+ protected function setTriggerClientTestResources( $triggerClientTestResources = true ) {
+ $this->triggerClientTestResources = $triggerClientTestResources;
+ }
+}