diff options
Diffstat (limited to 'maintenance/tests/selenium')
34 files changed, 0 insertions, 2325 deletions
diff --git a/maintenance/tests/selenium/Selenium.php b/maintenance/tests/selenium/Selenium.php deleted file mode 100644 index ecf7f9ec..00000000 --- a/maintenance/tests/selenium/Selenium.php +++ /dev/null @@ -1,190 +0,0 @@ -<?php -/** - * Selenium connector - * This is implemented as a singleton. - */ - -require( 'Testing/Selenium.php' ); - -class Selenium { - protected static $_instance = null; - - public $isStarted = false; - public $tester; - - protected $port; - protected $host; - protected $browser; - protected $browsers; - protected $logger; - protected $user; - protected $pass; - protected $timeout = 30000; - protected $verbose; - protected $junitlogfile; //processed by phpUnderControl - protected $runagainstgrid = false; - - /** - * @todo this shouldn't have to be static - */ - static protected $url; - - /** - * Override parent - */ - public function __construct() { - /** - * @todo this is an ugly hack to make information available to - * other tests. It should be fixed. - */ - if ( null === self::$_instance ) { - self::$_instance = $this; - } else { - throw new MWException( "Already have one Selenium instance." ); - } - } - - public function start() { - $this->tester = new Testing_Selenium( $this->browser, self::$url, $this->host, - $this->port, $this->timeout ); - if ( method_exists( $this->tester, "setVerbose" ) ) $this->tester->setVerbose( $this->verbose ); - - $this->tester->start(); - $this->isStarted = true; - } - - public function stop() { - $this->tester->stop(); - $this->tester = null; - $this->isStarted = false; - } - - public function login() { - if ( strlen( $this->user ) == 0 ) { - return; - } - $this->open( self::$url . '/index.php?title=Special:Userlogin' ); - $this->type( 'wpName1', $this->user ); - $this->type( 'wpPassword1', $this->pass ); - $this->click( "//input[@id='wpLoginAttempt']" ); - $this->waitForPageToLoad( 10000 ); - - // after login we redirect to the main page. So check whether the "Prefernces" top menu item exists - $value = $this->isElementPresent( "//li[@id='pt-preferences']" ); - - if ( $value != true ) { - throw new Testing_Selenium_Exception( "Login Failed" ); - } - - } - - public static function getInstance() { - if ( null === self::$_instance ) { - throw new MWException( "No instance set yet" ); - } - - return self::$_instance; - } - - public function loadPage( $title, $action ) { - $this->open( self::$url . '/index.php?title=' . $title . '&action=' . $action ); - } - - public function setLogger( $logger ) { - $this->logger = $logger; - } - - public function getLogger( ) { - return $this->logger; - } - - public function log( $message ) { - $this->logger->write( $message ); - } - - public function setUrl( $url ) { - self::$url = $url; - } - - static public function getUrl() { - return self::$url; - } - - public function setPort( $port ) { - $this->port = $port; - } - - public function getPort() { - return $this->port; - } - - public function setUser( $user ) { - $this->user = $user; - } - - // Function to get username - public function getUser() { - return $this->user; - } - - - public function setPass( $pass ) { - $this->pass = $pass; - } - - //add function to get password - public function getPass( ) { - return $this->pass; - } - - - public function setHost( $host ) { - $this->host = $host; - } - - public function setVerbose( $verbose ) { - $this->verbose = $verbose; - } - - public function setAvailableBrowsers( $availableBrowsers ) { - $this->browsers = $availableBrowsers; - } - - public function setJUnitLogfile( $junitlogfile ) { - $this->junitlogfile = $junitlogfile; - } - - public function getJUnitLogfile( ) { - return $this->junitlogfile; - } - - public function setRunAgainstGrid( $runagainstgrid ) { - $this->runagainstgrid = $runagainstgrid; - } - - public function setBrowser( $b ) { - if ($this->runagainstgrid) { - $this->browser = $b; - return true; - } - if ( !isset( $this->browsers[$b] ) ) { - throw new MWException( "Invalid Browser: $b.\n" ); - } - - $this->browser = $this->browsers[$b]; - } - - public function getAvailableBrowsers() { - return $this->browsers; - } - - public function __call( $name, $args ) { - $t = call_user_func_array( array( $this->tester, $name ), $args ); - return $t; - } - - // Prevent external cloning - protected function __clone() { } - // Prevent external construction - // protected function __construct() {} -} diff --git a/maintenance/tests/selenium/SeleniumConfig.php b/maintenance/tests/selenium/SeleniumConfig.php deleted file mode 100644 index ca69b1f0..00000000 --- a/maintenance/tests/selenium/SeleniumConfig.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -if ( !defined( 'SELENIUMTEST' ) ) { - die( 1 ); -} - -class SeleniumConfig { - - /* - * Retreives the Selenium configuration values from an ini file. - * See sample config file in selenium_settings.ini.sample - * - */ - - public static function getSeleniumSettings ( &$seleniumSettings, - &$seleniumBrowsers, - &$seleniumTestSuites, - $seleniumConfigFile = null ) { - if ( strlen( $seleniumConfigFile ) == 0 ) { - global $wgSeleniumConfigFile; - if ( isset( $wgSeleniumConfigFile ) ) $seleniumConfigFile = $wgSeleniumConfigFile ; - } - - if ( strlen( $seleniumConfigFile ) == 0 || !file_exists( $seleniumConfigFile ) ) { - throw new MWException( "Unable to read local Selenium Settings from " . $seleniumConfigFile . "\n" ); - } - - if ( !defined( 'PHP_VERSION_ID' ) || - ( PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3 ) ) { - $configArray = self::parse_5_2_ini_file( $seleniumConfigFile ); - } else { - $configArray = parse_ini_file( $seleniumConfigFile, true ); - } - if ( $configArray === false ) { - throw new MWException( "Error parsing " . $seleniumConfigFile . "\n" ); - } - - if ( array_key_exists( 'SeleniumSettings', $configArray) ) { - wfSuppressWarnings(); - //we may need to change how this is set. But for now leave it in the ini file - $seleniumBrowsers = $configArray['SeleniumSettings']['browsers']; - - $seleniumSettings['host'] = $configArray['SeleniumSettings']['host']; - $seleniumSettings['port'] = $configArray['SeleniumSettings']['port']; - $seleniumSettings['wikiUrl'] = $configArray['SeleniumSettings']['wikiUrl']; - $seleniumSettings['username'] = $configArray['SeleniumSettings']['username']; - $seleniumSettings['userPassword'] = $configArray['SeleniumSettings']['userPassword']; - $seleniumSettings['testBrowser'] = $configArray['SeleniumSettings']['testBrowser']; - $seleniumSettings['startserver'] = $configArray['SeleniumSettings']['startserver']; - $seleniumSettings['stopserver'] = $configArray['SeleniumSettings']['stopserver']; - $seleniumSettings['seleniumserverexecpath'] = $configArray['SeleniumSettings']['seleniumserverexecpath']; - $seleniumSettings['jUnitLogFile'] = $configArray['SeleniumSettings']['jUnitLogFile']; - $seleniumSettings['runAgainstGrid'] = $configArray['SeleniumSettings']['runAgainstGrid']; - - wfRestoreWarnings(); - } - if ( array_key_exists( 'SeleniumTests', $configArray) ) { - wfSuppressWarnings(); - $seleniumTestSuites = $configArray['SeleniumTests']['testSuite']; - wfRestoreWarnings(); - } - return true; - } - - private static function parse_5_2_ini_file ( $ConfigFile ) { - - $configArray = parse_ini_file( $ConfigFile, true ); - if ( $configArray === false ) return false; - - // PHP 5.2 ini files have [browsers] and [testSuite] sections - // to get around lack of support for array keys. It then - // inserts the section arrays into the appropriate places in - // the SeleniumSettings and SeleniumTests arrays. - - if ( isset( $configArray['browsers'] ) ) { - $configArray['SeleniumSettings']['browsers'] = $configArray['browsers']; - unset ( $configArray['browsers'] ); - } - - if ( isset( $configArray['testSuite'] ) ) { - $configArray['SeleniumTests']['testSuite'] = $configArray['testSuite']; - unset ( $configArray['testSuite'] ); - } - - return $configArray; - - } - -} diff --git a/maintenance/tests/selenium/SeleniumLoader.php b/maintenance/tests/selenium/SeleniumLoader.php deleted file mode 100644 index 8d5e7713..00000000 --- a/maintenance/tests/selenium/SeleniumLoader.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -class SeleniumLoader { - static function load() { - require_once( 'Testing/Selenium.php' ); - require_once( 'PHPUnit/Framework.php' ); - require_once( 'PHPUnit/Extensions/SeleniumTestCase.php' ); - } -} diff --git a/maintenance/tests/selenium/SeleniumServerManager.php b/maintenance/tests/selenium/SeleniumServerManager.php deleted file mode 100644 index ae5ea682..00000000 --- a/maintenance/tests/selenium/SeleniumServerManager.php +++ /dev/null @@ -1,239 +0,0 @@ -<?php -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - */ - -class SeleniumServerManager { - private $SeleniumStartServer = false; - private $OS = ''; - private $SeleniumServerPid = 'NaN'; - private $SeleniumServerPort = 4444; - private $SeleniumServerStartTimeout = 10; // 10 secs. - private $SeleniumServerExecPath; - - public function __construct( $startServer, - $serverPort, - $serverExecPath ) { - $this->OS = (string) PHP_OS; - if ( isset( $startServer ) ) - $this->SeleniumStartServer = $startServer; - if ( isset( $serverPort ) ) - $this->SeleniumServerPort = $serverPort; - if ( isset( $serverExecPath ) ) - $this->SeleniumServerExecPath = $serverExecPath; - return; - } - - // Getters for certain private attributes. No setters, since they - // should not change after the manager object is created. - - public function getSeleniumStartServer() { - return $this->SeleniumStartServer; - } - - public function getSeleniumServerPort() { - return $this->SeleniumServerPort; - } - - public function getSeleniumServerPid() { - return $this->SeleniumServerPid; - } - - // Changing value of SeleniumStartServer allows starting server after - // creation of the class instance. Only allow setting SeleniumStartServer - // to true, since after server is started, it is shut down by stop(). - - public function setSeleniumStartServer( $startServer ) { - if ( $startServer == true ) $this->SeleniumStartServer = true; - } - - // return values are: 1) started - server started, 2) failed - - // server not started, 3) running - instructed to start server, but - // server already running - - public function start() { - - if ( !$this->SeleniumStartServer ) return 'failed'; - - // commented out cases are untested - - switch ( $this->OS ) { - case "Linux": -# case' CYGWIN_NT-5.1': - case 'Darwin': -# case 'FreeBSD': -# case 'HP-UX': -# case 'IRIX64': -# case 'NetBSD': -# case 'OpenBSD': -# case 'SunOS': -# case 'Unix': - // *nix based OS - return $this->startServerOnUnix(); - break; - case "Windows": - case "WIN32": - case "WINNT": - // Windows - return $this->startServerOnWindows(); - break; - default: - // An untested OS - return 'failed'; - break; - } - } - - public function stop() { - - // commented out cases are untested - - switch ( $this->OS ) { - case "Linux": -# case' CYGWIN_NT-5.1': - case 'Darwin': -# case 'FreeBSD': -# case 'HP-UX': -# case 'IRIX64': -# case 'NetBSD': -# case 'OpenBSD': -# case 'SunOS': -# case 'Unix': - // *nix based OS - return $this->stopServerOnUnix(); - break; - case "Windows": - case "WIN32": - case "WINNT": - // Windows - return $this->stopServerOnWindows(); - break; - default: - // An untested OS - return 'failed'; - break; - } - } - - private function startServerOnUnix() { - - $output = array(); - $user = $_ENV['USER']; - // @fixme this should be a little more generalized :) - if (PHP_OS == 'Darwin') { - // Mac OS X's ps barfs on the 'w' param, but doesn't need it. - $ps = "ps -U %s"; - } else { - // Good on Linux - $ps = "ps -U %s w"; - } - $psCommand = sprintf($ps, escapeshellarg($user)); - exec($psCommand . " | grep -i selenium-server", $output); - - // Start server. If there is already a server running, - // return running. - - if ( isset( $this->SeleniumServerExecPath ) ) { - $found = 0; - foreach ( $output as $string ) { - $found += preg_match( - '~^(.*)java(.+)-jar(.+)selenium-server~', - $string ); - } - if ( $found == 0 ) { - - // Didn't find the selenium server. Start it up. - // First set up comamand line suffix. - // NB: $! is pid of last job run in background - // The echo guarentees it is put into $op when - // the exec command is run. - - $commandSuffix = ' > /dev/null 2>&1'. ' & echo $!'; - $portText = ' -port ' . $this->SeleniumServerPort; - $command = "java -jar " . - escapeshellarg($this->SeleniumServerExecPath) . - $portText . $commandSuffix; - exec($command ,$op); - $pid = (int)$op[0]; - if ( $pid != "" ) - $this->SeleniumServerPid = $pid; - else { - $this->SeleniumServerPid = 'NaN'; - // Server start failed. - return 'failed'; - } - // Wait for the server to startup and listen - // on its port. Note: this solution kinda - // stinks, since it uses a wait loop - dnessett - - wfSuppressWarnings(); - for ( $cnt = 1; - $cnt <= $this->SeleniumServerStartTimeout; - $cnt++ ) { - $fp = fsockopen ( 'localhost', - $this->SeleniumServerPort, - $errno, $errstr, 0 ); - if ( !$fp ) { - sleep( 1 ); - continue; - // Server start succeeded. - } else { - fclose ( $fp ); - return 'started'; - } - } - wfRestoreWarnings(); - echo ( "Starting Selenium server timed out.\n" ); - return 'failed'; - } - // server already running. - else return 'running'; - - } - // No Server execution path defined. - return 'failed'; - } - - private function startServerOnWindows() { - // Unimplemented. - return 'failed'; - } - - private function stopServerOnUnix() { - - if ( !empty( $this->SeleniumServerPid ) && - $this->SeleniumServerPid != 'NaN' ) { - exec( "kill -9 " . $this->SeleniumServerPid ); - return 'stopped'; - } - else return 'failed'; - } - - private function stopServerOnWindows() { - // Unimplemented. - return 'failed'; - - } -} diff --git a/maintenance/tests/selenium/SeleniumTestCase.php b/maintenance/tests/selenium/SeleniumTestCase.php deleted file mode 100644 index 11e1b192..00000000 --- a/maintenance/tests/selenium/SeleniumTestCase.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php -class SeleniumTestCase extends PHPUnit_Framework_TestCase { // PHPUnit_Extensions_SeleniumTestCase - protected $selenium; - - public function setUp() { - set_time_limit( 60 ); - $this->selenium = Selenium::getInstance(); - } - - public function tearDown() { - - } - - public function __call( $method, $args ) { - return call_user_func_array( array( $this->selenium, $method ), $args ); - } - - public function assertSeleniumAttributeEquals( $attribute, $value ) { - $attr = $this->getAttribute( $attribute ); - $this->assertEquals( $attr, $value ); - } - - public function assertSeleniumHTMLContains( $element, $text ) { - $innerHTML = $this->getText( $element ); - // or assertContains - $this->assertRegExp( "/$text/", $innerHTML ); - } - -//Common Funtions Added for Selenium Tests - - public function getExistingPage(){ - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->type("searchInput", "new" ); - $this->click("searchGoButton"); - $this->waitForPageToLoad("30000"); - } - - public function getNewPage($pageName){ - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->type("searchInput", $pageName ); - $this->click("searchGoButton"); - $this->waitForPageToLoad("30000"); - $this->click("link=".$pageName); - $this->waitForPageToLoad("600000"); - - - } - // Loading the mediawiki editor - public function loadWikiEditor(){ - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - } - - // Clear the content of the mediawiki editor - public function clearWikiEditor(){ - $this->type("wpTextbox1", ""); - } - - // Click on the 'Show preview' button of the mediawiki editor - public function clickShowPreviewBtn(){ - $this->click("wpPreview"); - } - - // Click on the 'Save Page' button of the mediawiki editor - public function clickSavePageBtn(){ - $this->click("wpSave"); - } - - // Click on the 'Edit' link - public function clickEditLink(){ - $this->click("link=Edit"); - $this->waitForPageToLoad("30000"); - } - - public function deletePage($pageName){ - $isLinkPresent = False; - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->click("link=Log out"); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); - $this->type( "wpName1", "nadeesha" ); - $this->type( "wpPassword1", "12345" ); - $this->click( "wpLoginAttempt" ); - $this->waitForPageToLoad( "30000" ); - $this->type( "searchInput", $pageName ); - $this->click( "searchGoButton"); - $this->waitForPageToLoad( "30000" ); - - $this->click( "link=Delete" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "wpConfirmB" ); - $this->waitForPageToLoad( "30000" ); - - } - - - -} diff --git a/maintenance/tests/selenium/SeleniumTestConsoleLogger.php b/maintenance/tests/selenium/SeleniumTestConsoleLogger.php deleted file mode 100644 index b6f5496c..00000000 --- a/maintenance/tests/selenium/SeleniumTestConsoleLogger.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -class SeleniumTestConsoleLogger { - public function __construct() { - // Prepare testsuite for immediate output - @ini_set( 'zlib.output_compression', 0 ); - @ini_set( 'implicit_flush', 1 ); - for ( $i = 0; $i < ob_get_level(); $i++ ) { - ob_end_flush(); - } - ob_implicit_flush( 1 ); - } - - public function write( $message, $mode = false ) { - $out = ''; - // if ( $mode == SeleniumTestSuite::RESULT_OK ) $out .= '<font color="green">'; - $out .= htmlentities( $message ); - // if ( $mode == SeleniumTestSuite::RESULT_OK ) $out .= '</font>'; - if ( $mode != SeleniumTestSuite::CONTINUE_LINE ) { - $out .= "\n"; - } - - echo $out; - } -} diff --git a/maintenance/tests/selenium/SeleniumTestHTMLLogger.php b/maintenance/tests/selenium/SeleniumTestHTMLLogger.php deleted file mode 100644 index 21332cf0..00000000 --- a/maintenance/tests/selenium/SeleniumTestHTMLLogger.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -class SeleniumTestHTMLLogger { - public function setHeaders() { - global $wgOut; - $wgOut->addHeadItem( 'selenium', '<style type="text/css"> - .selenium pre { - overflow-x: auto; /* Use horizontal scroller if needed; for Firefox 2, not needed in Firefox 3 */ - white-space: pre-wrap; /* css-3 */ - white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - /* width: 99%; */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ - } - .selenium-success { color: green } - </style>' ); - } - - public function write( $message, $mode = false ) { - global $wgOut; - $out = ''; - if ( $mode == SeleniumTestSuite::RESULT_OK ) { - $out .= '<span class="selenium-success">'; - } - $out .= htmlspecialchars( $message ); - if ( $mode == SeleniumTestSuite::RESULT_OK ) { - $out .= '</span>'; - } - if ( $mode != SeleniumTestSuite::CONTINUE_LINE ) { - $out .= '<br />'; - } - - $wgOut->addHTML( $out ); - } -} diff --git a/maintenance/tests/selenium/SeleniumTestListener.php b/maintenance/tests/selenium/SeleniumTestListener.php deleted file mode 100644 index 9436f672..00000000 --- a/maintenance/tests/selenium/SeleniumTestListener.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -class SeleniumTestListener implements PHPUnit_Framework_TestListener { - private $logger; - private $tests_ok = 0; - private $tests_failed = 0; - - public function __construct( $loggerInstance ) { - $this->logger = $loggerInstance; - } - - public function addError( PHPUnit_Framework_Test $test, Exception $e, $time ) { - $this->logger->write( 'Error: ' . $e->getMessage() ); - $this->tests_failed++; - } - - public function addFailure( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time ) - { - $this->logger->write( 'Failed: ' . $e->getMessage() ); - $this->tests_failed++; - } - - public function addIncompleteTest( PHPUnit_Framework_Test $test, Exception $e, $time ) - { - $this->logger->write( 'Incomplete.' ); - $this->tests_failed++; - } - - public function addSkippedTest( PHPUnit_Framework_Test $test, Exception $e, $time ) - { - $this->logger->write( 'Skipped.' ); - $this->tests_failed++; - } - - public function startTest( PHPUnit_Framework_Test $test ) { - $this->logger->write( - 'Testing ' . $test->getName() . ' ... ', - SeleniumTestSuite::CONTINUE_LINE - ); - } - - public function endTest( PHPUnit_Framework_Test $test, $time ) { - if ( !$test->hasFailed() ) { - $this->logger->write( 'OK', SeleniumTestSuite::RESULT_OK ); - $this->tests_ok++; - } - } - - public function startTestSuite( PHPUnit_Framework_TestSuite $suite ) { - $this->logger->write( 'Testsuite ' . $suite->getName() . ' started.' ); - $this->tests_ok = 0; - $this->tests_failed = 0; - } - - public function endTestSuite( PHPUnit_Framework_TestSuite $suite ) { - $this->logger->write('Testsuite ' . $suite->getName() . ' ended.' ); - if ( $this->tests_ok > 0 || $this->tests_failed > 0 ) { - $this->logger->write( ' OK: ' . $this->tests_ok . ' Failed: ' . $this->tests_failed ); - } - $this->tests_ok = 0; - $this->tests_failed = 0; - } - - public function statusMessage( $message ) { - $this->logger->write( $message ); - } -} - diff --git a/maintenance/tests/selenium/SeleniumTestSuite.php b/maintenance/tests/selenium/SeleniumTestSuite.php deleted file mode 100644 index ba178051..00000000 --- a/maintenance/tests/selenium/SeleniumTestSuite.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -abstract class SeleniumTestSuite extends PHPUnit_Framework_TestSuite { - private $selenium; - private $isSetUp = false; - private $loginBeforeTests = true; - - // Do not add line break after test output - const CONTINUE_LINE = 1; - const RESULT_OK = 2; - const RESULT_ERROR = 3; - - public abstract 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(); - $this->selenium->open( $this->selenium->getUrl() . '/index.php?setupTestSuite=' . $this->getName() ); - if ( $this->loginBeforeTests ) { - $this->login(); - } - } - - public function tearDown() { - $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; - } -} diff --git a/maintenance/tests/selenium/data/Wikipedia-logo-v2-de.png b/maintenance/tests/selenium/data/Wikipedia-logo-v2-de.png Binary files differdeleted file mode 100644 index 70385243..00000000 --- a/maintenance/tests/selenium/data/Wikipedia-logo-v2-de.png +++ /dev/null diff --git a/maintenance/tests/selenium/selenium_settings.ini.php52.sample b/maintenance/tests/selenium/selenium_settings.ini.php52.sample deleted file mode 100644 index ad21037e..00000000 --- a/maintenance/tests/selenium/selenium_settings.ini.php52.sample +++ /dev/null @@ -1,23 +0,0 @@ -[browsers] - -firefox = "*firefox" -iexploreproxy = "*iexploreproxy" -chrome = "*chrome" - -[SeleniumSettings] - -host = "localhost" -port = "4444" -wikiUrl = "http://localhost/mediawiki/latest_trunk/trunk/phase3" -username = "Wikiadmin" -userPassword = "Wikiadminpw" -testBrowser = "firefox" -startserver = -stopserver = -jUnitLogFile = -runAgainstGrid = false - -[testSuite] - -SimpleSeleniumTestSuite = "maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php" -WikiEditorTestSuite = "extensions/WikiEditor/selenium/WikiEditorTestSuite.php" diff --git a/maintenance/tests/selenium/selenium_settings.ini.sample b/maintenance/tests/selenium/selenium_settings.ini.sample deleted file mode 100644 index bacc0a90..00000000 --- a/maintenance/tests/selenium/selenium_settings.ini.sample +++ /dev/null @@ -1,32 +0,0 @@ -[SeleniumSettings] - -; Set up the available browsers that Selenium can control. -browsers[firefox] = "*firefox" -browsers[iexplorer] = "*iexploreproxy" -browsers[chrome] = "*chrome" - -; The simple configurations above usually work on Linux, but Windows and -; Mac OS X hosts may need to specify a full path: -;browsers[firefox] = "*firefox /Applications/Firefox.app/Contents/MacOS/firefox-bin" -;browsers[firefox] = "*firefox C:\Program Files\Mozilla Firefox\firefox.exe" - -host = "localhost" -port = "4444" -wikiUrl = "http://localhost/deployment" -username = "wikiuser" -userPassword = "wikipass" -testBrowser = "firefox" -startserver = -stopserver = -jUnitLogFile = -runAgainstGrid = false - -; To let the test runner start and stop the selenium server, it needs the full -; path to selenium-server.jar from the selenium-remote-control package. -seleniumserverexecpath = "/opt/local/selenium-remote-control-1.0.3/selenium-server-1.0.3/selenium-server.jar" - -[SeleniumTests] - -testSuite[SimpleSeleniumTestSuite] = "maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php" -testSuite[WikiEditorTestSuite] = "extensions/WikiEditor/selenium/WikiEditorTestSuite.php" - diff --git a/maintenance/tests/selenium/selenium_settings_grid.ini.sample b/maintenance/tests/selenium/selenium_settings_grid.ini.sample deleted file mode 100644 index eca60b0a..00000000 --- a/maintenance/tests/selenium/selenium_settings_grid.ini.sample +++ /dev/null @@ -1,14 +0,0 @@ -[SeleniumSettings] - -host = "grid.tesla.usability.wikimedia.org" -port = "4444" -wikiUrl = "http://208.80.152.253:5001" -username = "wikiuser" -userPassword = "wikipass" -testBrowser = "Safari on OS X Snow Leopard" -jUnitLogFile = -runAgainstGrid = true - -[testSuite] - -SimpleSeleniumTestSuite = "maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php"
\ No newline at end of file diff --git a/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php b/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php deleted file mode 100644 index dd4bc005..00000000 --- a/maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php +++ /dev/null @@ -1,182 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - - -class AddContentToNewPageTestCase extends SeleniumTestCase { - - - // Add bold text and verify output - public function testAddBoldText() { - - $this->getExistingPage(); - $this->clickEditLink(); - $this->loadWikiEditor(); - $this->clearWikiEditor(); - $this->click( "//*[@id='mw-editbutton-bold']" ); - $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); - - // Verify bold text displayed on mediawiki preview - $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/p/b" )); - $this->assertTrue($this->isTextPresent( "Bold text" )); - } - - // Add italic text and verify output - public function testAddItalicText() { - - $this->getExistingPage(); - $this->clickEditLink(); - $this->loadWikiEditor(); - $this->clearWikiEditor(); - $this->click( "//*[@id='mw-editbutton-italic']" ); - $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); - - // Verify italic text displayed on mediawiki preview - $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/i")); - $this->assertTrue($this->isTextPresent( "Italic text" )); - } - - // Add internal link for a new page and verify output in the preview - public function testAddInternalLinkNewPage() { - $this->getExistingPage(); - $this->clickEditLink(); - $this->loadWikiEditor(); - $this->clearWikiEditor(); - $this->click( "//*[@id='mw-editbutton-link']" ); - $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); - - // Verify internal link displayed on mediawiki preview - $source = $this->getText( "//*[@id='wikiPreview']/p/a" ); - $correct = strstr( $source, "Link title" ); - $this->assertEquals( $correct, true ); - - $this->click( "link=Link title" ); - $this->waitForPageToLoad( "600000" ); - - // Verify internal link open as a new page - editing mode - $source = $this->getText( "firstHeading" ); - $correct = strstr( $source, "Editing Link title" ); - $this->assertEquals( $correct, true ); - } - - // Add external link and verify output in the preview - public function testAddExternalLink() { - $this->getExistingPage(); - $this->clickEditLink(); - $this->loadWikiEditor(); - $this->clearWikiEditor(); - $this->click( "//*[@id='mw-editbutton-extlink']" ); - $this->type( "wpTextbox1", "[http://www.google.com Google]" ); - $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); - - // Verify external links displayed on mediawiki preview - $source = $this->getText( "//*[@id='wikiPreview']/p/a" ); - $correct = strstr( $source, "Google" ); - $this->assertEquals( $correct, true ); - - $this->click( "link=Google" ); - $this->waitForPageToLoad( "600000" ); - - // Verify external link opens - $source = $this->getTitle(); - $correct = strstr( $source, "Google" ); - $this->assertEquals( $correct, true); - } - - // Add level 2 headline and verify output in the preview - public function testAddLevel2HeadLine() { - $blnElementPresent = False; - $blnTextPresent = False; - $this->getExistingPage(); - $this->clickEditLink(); - $this->loadWikiEditor(); - $this->clearWikiEditor(); - $this->click( "mw-editbutton-headline" ); - $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); - $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/h2" )); - - // Verify level 2 headline displayed on mediawiki preview - $source = $this->getText( "//*[@id='Headline_text']" ); - $correct = strstr( $source, "Headline text" ); - $this->assertEquals( $correct, true ); - } - - // Add text with ignore wiki format and verify output the preview - public function testAddNoWikiFormat() { - $this->getExistingPage(); - $this->clickEditLink(); - $this->loadWikiEditor(); - $this->clearWikiEditor(); - $this->click( "//*[@id='mw-editbutton-nowiki']" ); - $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); - - // Verify ignore wiki format text displayed on mediawiki preview - $source = $this->getText( "//div[@id='wikiPreview']/p" ); - $correct = strstr( $source, "Insert non-formatted text here" ); - $this->assertEquals( $correct, true ); - } - - // Add signature and verify output in the preview - public function testAddUserSignature() { - $this->getExistingPage(); - $this->clickEditLink(); - $this->loadWikiEditor(); - $this->clearWikiEditor(); - $this->click( "mw-editbutton-signature" ); - $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); - - // Verify signature displayed on mediawiki preview - $source = $this->getText( "//*[@id='wikiPreview']/p/a" ); - $username = $this->getText( "//*[@id='pt-userpage']/a" ); - $correct = strstr( $source, $username ); - $this->assertEquals( $correct, true ); - } - - // Add horizontal line and verify output in the preview - public function testHorizontalLine() { - $this->getExistingPage(); - $this->clickEditLink(); - $this->loadWikiEditor(); - $this->clearWikiEditor(); - $this->click( "mw-editbutton-hr" ); - - $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); - - // Verify horizontal line displayed on mediawiki preview - $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" )); - $this->deletePage( "new" ); - } -} diff --git a/maintenance/tests/selenium/suites/AddNewPageTestCase.php b/maintenance/tests/selenium/suites/AddNewPageTestCase.php deleted file mode 100644 index 423f2a2c..00000000 --- a/maintenance/tests/selenium/suites/AddNewPageTestCase.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - - -class AddNewPageTestCase extends SeleniumTestCase { - - // Verify adding a new page - public function testAddNewPage() { - $newPage = "new"; - $displayName = "New"; - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->type( "searchInput", $newPage ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "600000" ); - - // Verify 'Search results' text available - $source = $this->gettext( "firstHeading" ); - $correct = strstr( $source, "Search results" ); - $this->assertEquals( $correct, true); - - // Verify 'Create the page "<page name>" on this wiki' text available - $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" ); - $correct = strstr ( $source, "Create the page \"New\" on this wiki!" ); - $this->assertEquals( $correct, true ); - - $this->click( "link=".$displayName ); - $this->waitForPageToLoad( "600000" ); - - $this->assertTrue($this->isElementPresent( "link=Create" )); - $this->type( "wpTextbox1", "add new test page" ); - $this->click( "wpSave" ); - - // Verify new page added - $source = $this->gettext( "firstHeading" ); - $correct = strstr ( $source, $displayName ); - $this->assertEquals( $correct, true ); - } -} diff --git a/maintenance/tests/selenium/suites/CreateAccountTestCase.php b/maintenance/tests/selenium/suites/CreateAccountTestCase.php deleted file mode 100644 index 1cfda2e0..00000000 --- a/maintenance/tests/selenium/suites/CreateAccountTestCase.php +++ /dev/null @@ -1,114 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -Class CreateAccountTestCase extends SeleniumTestCase { - - // Change these values before run the test - private $userName = "yourname4000"; - private $password = "yourpass4000"; - - // Verify 'Log in/create account' link existance in Main page. - public function testMainPageLink() { - - $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); - - $this->open( $this->getUrl().'/index.php?title=Main_Page' ); - $this->assertTrue($this->isElementPresent( "link=Log in / create account" )); - } - - // Verify 'Create an account' link existance in 'Log in / create account' Page. - public function testCreateAccountPageLink() { - - $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); - - $this->open( $this->getUrl().'/index.php?title=Main_Page' ); - - // click Log in / create account link to open Log in / create account' page - $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); - $this->assertTrue($this->isElementPresent( "link=Create an account" )); - } - - // Verify Create account - public function testCreateAccount() { - - $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); - - $this->open( $this->getUrl().'/index.php?title=Main_Page' ); - - $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); - - $this->click( "link=Create an account" ); - $this->waitForPageToLoad( "30000" ); - - // Verify for blank user name - $this->type( "wpName2", "" ); - $this->click( "wpCreateaccount" ); - $this->waitForPageToLoad( "30000" ); - $this->assertEquals( "Login error\n You have not specified a valid user name.", - $this->getText( "//div[@id='bodyContent']/div[4]" )); - - // Verify for invalid user name - $this->type( "wpName2", "@" ); - $this->click("wpCreateaccount" ); - $this->waitForPageToLoad( "30000" ); - $this->assertEquals( "Login error\n You have not specified a valid user name.", - $this->getText( "//div[@id='bodyContent']/div[4]" )); - - // start of test for blank password - $this->type( "wpName2", $this->userName); - $this->type( "wpPassword2", "" ); - $this->click( "wpCreateaccount" ); - $this->waitForPageToLoad( "30000" ); - $this->assertEquals( "Login error\n Passwords must be at least 1 character.", - $this->getText("//div[@id='bodyContent']/div[4]" )); - - $this->type( "wpName2", $this->userName ); - $this->type( "wpPassword2", $this->password ); - $this->click( "wpCreateaccount" ); - $this->waitForPageToLoad( "30000" ); - $this->assertEquals( "Login error\n The passwords you entered do not match.", - $this->getText( "//div[@id='bodyContent']/div[4]" )); - - $this->type( "wpName2", $this->userName ); - $this->type( "wpPassword2", $this->password ); - $this->type( "wpRetype", $this->password ); - $this->click( "wpCreateaccount" ); - $this->waitForPageToLoad( "30000 "); - - // Verify successful account creation for valid combination of 'Username', 'Password', 'Retype password' - $this->assertEquals( "Welcome, ".ucfirst( $this->userName )."!", - $this->getText( "Welcome,_".ucfirst( $this->userName )."!" )); - } -} - diff --git a/maintenance/tests/selenium/suites/DeletePageAdminTestCase.php b/maintenance/tests/selenium/suites/DeletePageAdminTestCase.php deleted file mode 100644 index 40628986..00000000 --- a/maintenance/tests/selenium/suites/DeletePageAdminTestCase.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - - -class DeletePageAdminTestCase extends SeleniumTestCase { - - // Verify adding a new page - public function testDeletePage() { - - - $newPage = "new"; - $displayName = "New"; - - $this->open( $this->getUrl().'/index.php?title=Main_Page' ); - - $this->type( "searchInput", $newPage ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=".$displayName ); - $this->waitForPageToLoad( "60000" ); - $this->type( "wpTextbox1", $newPage." text" ); - $this->click( "wpSave" ); - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); - - $this->type( "wpName1", $this->selenium->getUser() ); - $this->type( "wpPassword1", $this->selenium->getPass() ); - $this->click( "wpLoginAttempt" ); - $this->waitForPageToLoad( "30000" ); - $this->type( "searchInput", "new" ); - $this->click( "searchGoButton"); - $this->waitForPageToLoad( "30000" ); - - // Verify 'Delete' link displayed - $source = $this->gettext( "link=Delete" ); - $correct = strstr ( $source, "Delete" ); - $this->assertEquals($correct, true ); - - $this->click( "link=Delete" ); - $this->waitForPageToLoad( "30000" ); - - // Verify 'Delete' button available - $this->assertTrue($this->isElementPresent( "wpConfirmB" )); - - $this->click( "wpConfirmB" ); - $this->waitForPageToLoad( "30000" ); - - // Verify 'Action complete' text displayed - $source = $this->gettext( "firstHeading" ); - $correct = strstr ( $source, "Action complete" ); - $this->assertEquals( $correct, true ); - - // Verify '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed - $source = $this->gettext( "//div[@id='bodyContent']/p[1]" ); - $correct = strstr ( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." ); - $this->assertEquals( $correct, true ); - } -} diff --git a/maintenance/tests/selenium/suites/EmailPasswordTestCase.php b/maintenance/tests/selenium/suites/EmailPasswordTestCase.php deleted file mode 100644 index 8356f43a..00000000 --- a/maintenance/tests/selenium/suites/EmailPasswordTestCase.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -class EmailPasswordTestCase extends SeleniumTestCase { - - // change user name for each and every test (with in 24 hours) - private $userName = "test1"; - - public function testEmailPasswordButton() { - - $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); - - $this->open( $this->getUrl().'/index.php?title=Main_Page' ); - - // click Log in / create account link to open Log in / create account' page - $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); - $this->assertTrue($this->isElementPresent( "wpMailmypassword" )); - } - - // Verify Email password functionality - public function testEmailPasswordMessages() { - - $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); - - $this->open( $this->getUrl().'/index.php?title=Main_Page' ); - - // click Log in / create account link to open Log in / create account' page - $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); - - $this->type( "wpName1", "" ); - $this->click( "wpMailmypassword" ); - $this->waitForPageToLoad( "30000" ); - $this->assertEquals( "Login error\n You have not specified a valid user name.", - $this->getText("//div[@id='bodyContent']/div[4]")); - - $this->type( "wpName1", $this->userName ); - $this->click( "wpMailmypassword" ); - $this->waitForPageToLoad( "30000" ); - - // Can not run on localhost - $this->assertEquals( "A new password has been sent to the e-mail address registered for ".ucfirst($this->userName).". Please log in again after you receive it.", - $this->getText("//div[@id='bodyContent']/div[4]" )); - - $this->type( "wpName1", $this->userName ); - $this->click( "wpMailmypassword" ); - $this->waitForPageToLoad( "30000" ); - $this->assertEquals( "Login error\n A password reminder has already been sent, within the last 24 hours. To prevent abuse, only one password reminder will be sent per 24 hours.", - $this->getText( "//div[@id='bodyContent']/div[4]" )); - } -} - diff --git a/maintenance/tests/selenium/suites/MediaWikExtraTestSuite.php b/maintenance/tests/selenium/suites/MediaWikExtraTestSuite.php deleted file mode 100644 index 205cb332..00000000 --- a/maintenance/tests/selenium/suites/MediaWikExtraTestSuite.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -class MediaWikExtraTestSuite extends SeleniumTestSuite { - public function setUp() { - $this->setLoginBeforeTests( true ); - parent::setUp(); - } - public function addTests() { - $testFiles = array( - 'maintenance/tests/selenium/suites/MyContributionsTestCase.php', - 'maintenance/tests/selenium/suites/MyWatchListTestCase.php', - 'maintenance/tests/selenium/suites/UserPreferencesTestCase.php', - 'maintenance/tests/selenium/suites/MovePageTestCase.php', - 'maintenance/tests/selenium/suites/PageSearchTestCase.php', - 'maintenance/tests/selenium/suites/EmailPasswordTestCase.php', - 'maintenance/tests/selenium/suites/CreateAccountTestCase.php' - ); - parent::addTestFiles( $testFiles ); - } -} diff --git a/maintenance/tests/selenium/suites/MediaWikiEditorConfig.php b/maintenance/tests/selenium/suites/MediaWikiEditorConfig.php deleted file mode 100644 index 2803117d..00000000 --- a/maintenance/tests/selenium/suites/MediaWikiEditorConfig.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -class MediaWikiEditorConfig { - - public static function getSettings(&$includeFiles, &$globalConfigs) { - $includes = array( - //files that needed to be included would go here - 'maintenance/tests/selenium/suites/MediaWikiCommonFunction.php' - ); - $configs = array( - 'wgPageLoadTime' => "600000" - ); - $includeFiles = array_merge( $includeFiles, $includes ); - $globalConfigs = array_merge( $globalConfigs, $configs); - return true; - } -} - - - diff --git a/maintenance/tests/selenium/suites/MediaWikiEditorTestSuite.php b/maintenance/tests/selenium/suites/MediaWikiEditorTestSuite.php deleted file mode 100644 index 06046365..00000000 --- a/maintenance/tests/selenium/suites/MediaWikiEditorTestSuite.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -class MediaWikiEditorTestSuite extends SeleniumTestSuite { - public function setUp() { - $this->setLoginBeforeTests( true ); - parent::setUp(); - } - public function addTests() { - $testFiles = array( - 'maintenance/tests/selenium/suites/AddNewPageTestCase.php', - 'maintenance/tests/selenium/suites/AddContentToNewPageTestCase.php', - 'maintenance/tests/selenium/suites/PreviewPageTestCase.php', - 'maintenance/tests/selenium/suites/SavePageTestCase.php', - ); - parent::addTestFiles( $testFiles ); - } -} - diff --git a/maintenance/tests/selenium/suites/MediawikiCoreSmokeTestCase.php b/maintenance/tests/selenium/suites/MediawikiCoreSmokeTestCase.php deleted file mode 100644 index 7b9525af..00000000 --- a/maintenance/tests/selenium/suites/MediawikiCoreSmokeTestCase.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/* - * Stub of tests be need as part of the hack-a-ton - */ -class MediawikiCoreSmokeTestCase extends SeleniumTestCase { - public function testUserLogin() { - - } - - public function testChangeUserPreference() { - - } - - /* - * TODO: generalize this test to be reusable for different skins - */ - public function testCreateNewPageVector() { - - } - - /* - * TODO: generalize this test to be reusable for different skins - */ - public function testEditExistingPageVector() { - - } - - /* - * TODO: generalize this test to be reusable for different skins - */ - public function testCreateNewPageMonobook() { - - } - - /* - * TODO: generalize this test to be reusable for different skins - */ - public function testEditExistingPageMonobook() { - - } - - public function testImageUpload() { - $this->login(); - $this->open( $this->getUrl() . - '/index.php?title=Special:Upload' ); - $this->type( 'wpUploadFile', dirname( __FILE__ ) . - "\\..\\data\\Wikipedia-logo-v2-de.png" ); - $this->check( 'wpIgnoreWarning' ); - $this->click( 'wpUpload' ); - $this->waitForPageToLoad( 30000 ); - - $this->assertSeleniumHTMLContains( - '//h1[@class="firstHeading"]', "Wikipedia-logo-v2-de.png" ); - - /* - $this->open( $this->getUrl() . '/index.php?title=Image:' - . ucfirst( $this->filename ) . '&action=delete' ); - $this->type( 'wpReason', 'Remove test file' ); - $this->click( 'mw-filedelete-submit' ); - $this->waitForPageToLoad( 10000 ); - - // Todo: This message is localized - $this->assertSeleniumHTMLContains( '//div[@id="bodyContent"]/p', - ucfirst( $this->filename ) . '.*has been deleted.' ); - */ - } - - -} diff --git a/maintenance/tests/selenium/suites/MediawikiCoreSmokeTestSuite.php b/maintenance/tests/selenium/suites/MediawikiCoreSmokeTestSuite.php deleted file mode 100644 index 76287b23..00000000 --- a/maintenance/tests/selenium/suites/MediawikiCoreSmokeTestSuite.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/* - * Stubs for now. We're going to start populating this test. - */ -class MediawikiCoreSmokeTestSuite extends SeleniumTestSuite -{ - public function setUp() { - $this->setLoginBeforeTests( false ); - parent::setUp(); - } - public function addTests() { - $testFiles = array( - 'maintenance/tests/selenium/suites/MediawikiCoreSmokeTestCase.php' - ); - parent::addTestFiles( $testFiles ); - } - - -} diff --git a/maintenance/tests/selenium/suites/MovePageTestCase.php b/maintenance/tests/selenium/suites/MovePageTestCase.php deleted file mode 100644 index d4d3b1f2..00000000 --- a/maintenance/tests/selenium/suites/MovePageTestCase.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -class MovePageTestCase extends SeleniumTestCase { - - // Verify move(rename) wiki page - public function testMovePage() { - - $newPage = "mypage99"; - $displayName = "Mypage99"; - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->type( "searchInput", $newPage ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=".$displayName ); - $this->waitForPageToLoad( "60000" ); - $this->type( "wpTextbox1", $newPage." text" ); - $this->click( "wpSave" ); - $this->waitForPageToLoad( "60000" ); - - // Verify link 'Move' available - $this->assertTrue($this->isElementPresent( "link=Move" )); - - $this->click( "link=Move" ); - $this->waitForPageToLoad( "30000" ); - - // Verify correct page name displayed under 'Move Page' field - $this->assertEquals($displayName, - $this->getText("//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a")); - $movePageName = $this->getText( "//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a" ); - - // Verify 'To new title' field has current page name as the default name - $newTitle = $this->getValue( "wpNewTitle" ); - $correct = strstr( $movePageName , $newTitle ); - $this->assertEquals( $correct, true ); - - $this->type( "wpNewTitle", $displayName ); - $this->click( "wpMove" ); - $this->waitForPageToLoad( "30000" ); - - // Verify warning message for the same source and destination titles - $this->assertEquals( "Source and destination titles are the same; cannot move a page over itself.", - $this->getText("//div[@id='bodyContent']/p[4]/strong" )); - - // Verify warning message for the blank title - $this->type( "wpNewTitle", "" ); - $this->click( "wpMove" ); - $this->waitForPageToLoad( "30000" ); - - // Verify warning message for the blank title - $this->assertEquals( "The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.", - $this->getText( "//div[@id='bodyContent']/p[4]/strong" )); - - // Verify warning messages for the invalid titles - $this->type( "wpNewTitle", "# < > [ ] | { }" ); - $this->click( "wpMove" ); - $this->waitForPageToLoad( "30000" ); - $this->assertEquals( "The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.", - $this->getText( "//div[@id='bodyContent']/p[4]/strong" )); - - $this->type( "wpNewTitle", $displayName."move" ); - $this->click( "wpMove" ); - $this->waitForPageToLoad( "30000" ); - - // Verify move success message displayed correctly - $this->assertEquals( "\"".$displayName."\" has been moved to \"".$displayName."move"."\"", - $this->getText( "//div[@id='bodyContent']/p[1]/b" )); - - $this->type( "searchInput", $newPage."move" ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); - - // Verify search using new page name - $this->assertEquals( $displayName."move", $this->getText( "firstHeading" )); - - $this->type( "searchInput", $newPage ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); - - // Verify search using old page name - $redirectPageName = $this->getText( "//*[@id='contentSub']" ); - $this->assertEquals( "(Redirected from ".$displayName.")" , $redirectPageName ); - - // newpage delete - $this->deletePage( $newPage."move" ); - $this->deletePage( $newPage ); - } -} - diff --git a/maintenance/tests/selenium/suites/MyContributionsTestCase.php b/maintenance/tests/selenium/suites/MyContributionsTestCase.php deleted file mode 100644 index 95011c3b..00000000 --- a/maintenance/tests/selenium/suites/MyContributionsTestCase.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -class MyContributionsTestCase extends SeleniumTestCase { - - // Verify user contributions - public function testRecentChangesAvailability() { - - $newPage = "mypage999"; - $displayName = "Mypage999"; - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - - $this->type( "searchInput", $newPage); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "60000" ); - $this->click( "link=".$displayName ); - $this->waitForPageToLoad( "600000" ); - $this->type( "wpTextbox1", $newPage." text" ); - $this->click( "wpSave" ); - $this->waitForPageToLoad( "60000" ); - - // Verify My contributions Link available - $this->assertTrue($this->isElementPresent( "link=My contributions" )); - - $this->click( "link=My contributions" ); - $this->waitForPageToLoad( "30000" ); - - // Verify recent page adding available on My Contributions list - $this->assertEquals( $displayName, $this->getText( "link=".$displayName )); - - $this->type( "searchInput", $newPage ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); - - $this->click( "link=Edit" ); - $this->waitForPageToLoad( "30000" ); - $this->type( "wpTextbox1", $newPage." text changed" ); - $this->click( "wpSave" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=My contributions" ); - $this->waitForPageToLoad( "30000" ); - - // Verify recent page changes available on My Contributions - $this->assertTrue($this->isTextPresent($displayName." (top)")); - $this->deletePage($newPage); - } -} - diff --git a/maintenance/tests/selenium/suites/MyWatchListTestCase.php b/maintenance/tests/selenium/suites/MyWatchListTestCase.php deleted file mode 100644 index 150c1f51..00000000 --- a/maintenance/tests/selenium/suites/MyWatchListTestCase.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - - -class MyWatchListTestCase extends SeleniumTestCase { - - // Verify user watchlist - public function testMyWatchlist() { - - $newPage = "mypage"; - $displayName = "Mypage"; - $wikiText = "watch page"; - - $this->open( $this->getUrl().'/index.php?title=Main_Page' ); - - $this->type( "searchInput", $newPage ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=".$displayName ); - $this->waitForPageToLoad( "600000" ); - - $this->click( "wpWatchthis" ); - $this->type( "wpTextbox1",$wikiText ); - $this->click( "wpSave" ); - $this->waitForPageToLoad( "30000" ); - - // Verify link 'My Watchlist' available - $this->assertTrue( $this->isElementPresent( "link=My watchlist" ) ); - - $this->click( "link=My watchlist" ); - $this->waitForPageToLoad( "30000" ); - - // Verify newly added page to the watchlist is available - $watchList = $this->getText( "//*[@id='bodyContent']" ); - $this->assertContains( $displayName, $watchList ); - - $this->type( "searchInput", $newPage ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); - $this->click("link=Edit"); - $this->waitForPageToLoad( "30000" ); - $this->click( "wpWatchthis" ); - $this->click( "wpSave" ); - $this->deletePage( $newPage ); - } -} - diff --git a/maintenance/tests/selenium/suites/PageDeleteTestSuite.php b/maintenance/tests/selenium/suites/PageDeleteTestSuite.php deleted file mode 100644 index 2e535c11..00000000 --- a/maintenance/tests/selenium/suites/PageDeleteTestSuite.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -class PageDeleteTestSuite extends SeleniumTestSuite { - public function setUp() { - $this->setLoginBeforeTests( true ); - parent::setUp(); - } - public function addTests() { - $testFiles = array( - 'maintenance/tests/selenium/suites/DeletePageAdminTestCase.php' - ); - parent::addTestFiles( $testFiles ); - } - - -} diff --git a/maintenance/tests/selenium/suites/PageSearchTestCase.php b/maintenance/tests/selenium/suites/PageSearchTestCase.php deleted file mode 100644 index e139f7a0..00000000 --- a/maintenance/tests/selenium/suites/PageSearchTestCase.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -class PageSearchTestCase extends SeleniumTestCase { - - // Verify the functionality of the 'Go' button - public function testPageSearchBtnGo() { - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->type( "searchInput", "calcey qa" ); - $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "600000" ); - - // Verify no page matched with the entered search text - $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" ); - $correct = strstr ( $source, "Create the page \"Calcey qa\" on this wiki!" ); - $this->assertEquals( $correct, true ); - - $this->click( "link=Calcey qa" ); - $this->waitForPageToLoad( "600000" ); - - $this->type( "wpTextbox1", "Calcey QA team" ); - $this->click( "wpSave" ); - $this->waitForPageToLoad( "600000" ); - - } - - // Verify the functionality of the 'Search' button - public function testPageSearchBtnSearch() { - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->type( "searchInput", "Calcey web" ); - $this->click( "mw-searchButton" ); - $this->waitForPageToLoad( "30000" ); - - // Verify no page is available as the search text - $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p[2]/b" ); - $correct = strstr ( $source, "Create the page \"Calcey web\" on this wiki!" ); - $this->assertEquals( $correct, true ); - - $this->click( "link=Calcey web" ); - $this->waitForPageToLoad( "600000" ); - - $this->type( "wpTextbox1", "Calcey web team" ); - $this->click( "wpSave" ); - $this->waitForPageToLoad( "600000" ); - - // Verify saved page is opened when the exact page name is given - $this->type( "searchInput", "Calcey web" ); - $this->click( "mw-searchButton" ); - $this->waitForPageToLoad( "30000" ); - - // Verify exact page matched with the entered search text using 'Search' button - $source = $this->getText( "//*[@id='bodyContent']/div[4]/p/b" ); - $correct = strstr( $source, "There is a page named \"Calcey web\" on this wiki." ); - $this->assertEquals( $correct, true ); - - // Verify resutls available when partial page name is entered as the search text - $this->type( "searchInput", "Calcey" ); - $this->click( "mw-searchButton" ); - $this->waitForPageToLoad( "30000" ); - - // Verify text avaialble in the search result under the page titles - if($this->isElementPresent( "Page_title_matches" )) { - $textPageTitle = $this->getText( "//*[@id='bodyContent']/div[4]/ul[1]/li[1]/div[1]/a" ); - $this->assertContains( 'Calcey', $textPageTitle ); - } - - // Verify text avaialble in the search result under the page text - if($this->isElementPresent( "Page_text_matches" )) { - $textPageText = $this->getText( "//*[@id='bodyContent']/div[4]/ul[2]/li[2]/div[2]/span" ); - $this->assertContains( 'Calcey', $textPageText ); - } - $this->deletePage("Calcey QA"); - $this->deletePage("Calcey web"); - } -} diff --git a/maintenance/tests/selenium/suites/PreviewPageTestCase.php b/maintenance/tests/selenium/suites/PreviewPageTestCase.php deleted file mode 100644 index b704bf39..00000000 --- a/maintenance/tests/selenium/suites/PreviewPageTestCase.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -class PreviewPageTestCase extends SeleniumTestCase { - - // Verify adding a new page - public function testPreviewPage() { - $wikiText = "Adding this page to test the \n Preview button functionality"; - $newPage = "Test Preview Page"; - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->getNewPage( $newPage ); - $this->type( "wpTextbox1", $wikiText."" ); - $this->assertTrue($this->isElementPresent( "//*[@id='wpPreview']" )); - - $this->click( "wpPreview" ); - - // Verify saved page available - $source = $this->gettext( "firstHeading" ); - $correct = strstr( $source, "Test Preview Page" ); - $this->assertEquals( $correct, true); - - // Verify page content previewed succesfully - $contentOfPreviewPage = $this->getText( "//*[@id='content']" ); - $this->assertContains( $wikiText, $contentOfPreviewPage ); - } -} diff --git a/maintenance/tests/selenium/suites/SavePageTestCase.php b/maintenance/tests/selenium/suites/SavePageTestCase.php deleted file mode 100644 index 7f1a6924..00000000 --- a/maintenance/tests/selenium/suites/SavePageTestCase.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -class SavePageTestCase extends SeleniumTestCase { - - // Verify adding a new page - public function testSavePage() { - $wikiText = "Adding this page to test the Save button functionality"; - $newPage = "Test Save Page"; - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->getNewPage($newPage); - $this->type("wpTextbox1", $wikiText); - - // verify 'Save' button available - $this->assertTrue($this->isElementPresent( "wpSave" )); - $this->click( "wpSave" ); - - // Verify saved page available - $source = $this->gettext( "firstHeading" ); - $correct = strstr( $source, "Test Save Page" ); - - // Verify Saved page name displayed correctly - $this->assertEquals( $correct, true ); - - // Verify page content saved succesfully - $contentOfSavedPage = $this->getText( "//*[@id='content']" ); - $this->assertContains( $wikiText, $contentOfSavedPage ); - $this->deletePage( $newPage ); - } -} diff --git a/maintenance/tests/selenium/suites/SimpleSeleniumConfig.php b/maintenance/tests/selenium/suites/SimpleSeleniumConfig.php deleted file mode 100644 index cffa83c4..00000000 --- a/maintenance/tests/selenium/suites/SimpleSeleniumConfig.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php -class SimpleSeleniumConfig { - - public static function getSettings(&$includeFiles, &$globalConfigs) { - $includes = array( - //files that needed to be included would go here - ); - $configs = array( - 'wgDefaultSkin' => 'chick' - ); - $includeFiles = array_merge( $includeFiles, $includes ); - $globalConfigs = array_merge( $globalConfigs, $configs); - return true; - } -}
\ No newline at end of file diff --git a/maintenance/tests/selenium/suites/SimpleSeleniumTestCase.php b/maintenance/tests/selenium/suites/SimpleSeleniumTestCase.php deleted file mode 100644 index 8f01b437..00000000 --- a/maintenance/tests/selenium/suites/SimpleSeleniumTestCase.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/* - * This test case is part of the SimpleSeleniumTestSuite. - * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php - */ -class SimpleSeleniumTestCase extends SeleniumTestCase { - public function testBasic() { - $this->open( $this->getUrl() . - '/index.php?title=Selenium&action=edit' ); - $this->type( "wpTextbox1", "This is a basic test" ); - $this->click( "wpPreview" ); - $this->waitForPageToLoad( 10000 ); - - // check result - $source = $this->getText( "//div[@id='wikiPreview']/p" ); - $correct = strstr( $source, "This is a basic test" ); - $this->assertEquals( $correct, true ); - } - - /* - * All this test really does is verify that a global var was set. - * It depends on $wgDefaultSkin = 'chick'; being set - */ - public function testGlobalVariableForDefaultSkin() { - $this->open( $this->getUrl() . '/index.php?&action=purge' ); - $bodyClass = $this->getAttribute( "//body/@class" ); - $this-> assertContains('skin-chick', $bodyClass, 'Chick skin not set'); - } - -} diff --git a/maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php b/maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php deleted file mode 100644 index a04f33ed..00000000 --- a/maintenance/tests/selenium/suites/SimpleSeleniumTestSuite.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/* - * Sample test suite. - * Two ways to configure MW for these tests - * 1) If you are running multiple test suites, add the following in LocalSettings.php - * require_once("maintenance/tests/selenium/SimpleSeleniumConfig.php"); - * $wgSeleniumTestConfigs['SimpleSeleniumTestSuite'] = 'SimpleSeleniumConfig::getSettings'; - * OR - * 2) Add the following to your Localsettings.php - * $wgDefaultSkin = 'chick'; - */ -class SimpleSeleniumTestSuite extends SeleniumTestSuite -{ - public function setUp() { - $this->setLoginBeforeTests( false ); - parent::setUp(); - } - public function addTests() { - $testFiles = array( - 'maintenance/tests/selenium/suites/SimpleSeleniumTestCase.php' - ); - parent::addTestFiles( $testFiles ); - } - - -} diff --git a/maintenance/tests/selenium/suites/UserPreferencesTestCase.php b/maintenance/tests/selenium/suites/UserPreferencesTestCase.php deleted file mode 100644 index 12824307..00000000 --- a/maintenance/tests/selenium/suites/UserPreferencesTestCase.php +++ /dev/null @@ -1,179 +0,0 @@ -<?php - -/** - * Selenium server manager - * - * @file - * @ingroup Maintenance - * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com> - * http://citizendium.org/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup Maintenance - * - */ - -class UserPreferencesTestCase extends SeleniumTestCase { - - // Verify user information - public function testUserInfoDisplay() { - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); - - // Verify correct username displayed in User Preferences - $this->assertEquals( $this->getText( "//li[@id='pt-userpage']/a" ), - $this->getText( "//table[@id='mw-htmlform-info']/tbody/tr[1]/td[2]" )); - - // Verify existing Signature Displayed correctly - $this->assertEquals( $this->selenium->getUser(), - $this->getTable( "mw-htmlform-signature.0.1" ) ); - } - - // Verify change password - public function testChangePassword() { - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); - - $this->click( "link=Change password" ); - $this->waitForPageToLoad( "30000" ); - - $this->type( "wpPassword", "12345" ); - $this->type( "wpNewPassword", "54321" ); - $this->type( "wpRetype", "54321" ); - $this->click( "//input[@value='Change password']" ); - $this->waitForPageToLoad( "30000" ); - - $this->assertEquals( "Preferences", $this->getText( "firstHeading" )); - - $this->click( "link=Change password" ); - $this->waitForPageToLoad( "30000" ); - - $this->type( "wpPassword", "54321" ); - $this->type( "wpNewPassword", "12345" ); - $this->type( "wpRetype", "12345" ); - $this->click( "//input[@value='Change password']" ); - $this->waitForPageToLoad( "30000" ); - $this->assertEquals( "Preferences", $this->getText( "firstHeading" )); - - $this->click( "link=Change password" ); - $this->waitForPageToLoad( "30000" ); - - $this->type( "wpPassword", "54321" ); - $this->type( "wpNewPassword", "12345" ); - $this->type( "wpRetype", "12345" ); - $this->click( "//input[@value='Change password']" ); - $this->waitForPageToLoad( "30000" ); - } - - // Verify successful preferences save - public function testSuccessfullSave() { - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); - - $this->type( "mw-input-realname", "Test User" ); - $this->click( "prefcontrol" ); - $this->waitForPageToLoad( "30000" ); - - // Verify "Your preferences have been saved." message - $this->assertEquals( "Your preferences have been saved.", - $this->getText( "//div[@id='bodyContent']/div[4]/strong/p" )); - $this->type( "mw-input-realname", "" ); - $this->click( "prefcontrol" ); - $this->waitForPageToLoad( "30000" ); - - } - - // Verify change signature - public function testChangeSignature() { - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); - - $this->type( "mw-input-nickname", "TestSignature" ); - $this->click( "prefcontrol" ); - $this->waitForPageToLoad( "30000" ); - - // Verify change user signature - $this->assertEquals( "TestSignature", $this->getText( "link=TestSignature" )); - $this->type( "mw-input-nickname", "Test" ); - $this->click( "prefcontrol" ); - $this->waitForPageToLoad("30000"); - } - - // Verify change date format - public function testChangeDateFormatTimeZone() { - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=Date and time" ); - $this->waitForPageToLoad( "30000" ); - - $this->click( "mw-input-date-dmy" ); - $this->select( "mw-input-timecorrection", "label=Asia/Colombo" ); - $this->click( "prefcontrol" ); - $this->waitForPageToLoad( "30000" ); - - // Verify Date format and time zome saved - $this->assertEquals( "Your preferences have been saved.", - $this->getText( "//div[@id='bodyContent']/div[4]/strong/p" )); - } - - // Verify restoring all default settings - public function testSetAllDefault() { - - $this->open( $this->getUrl() . - '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); - - // Verify restoring all default settings - $this->assertEquals( "Restore all default settings", - $this->getText( "link=Restore all default settings" )); - - $this->click("//*[@id='preferences']/div/a"); - $this->waitForPageToLoad("30000"); - - // Verify 'This can not be undone' warning message displayed - $this->assertTrue($this->isElementPresent("//input[@value='Restore all default settings']")); - - // Verify 'Restore all default settings' button available - $this->assertEquals("You can use this page to reset your preferences to the site defaults. This cannot be undone.", - $this->getText("//div[@id='bodyContent']/p")); - - $this->click("//input[@value='Restore all default settings']"); - $this->waitForPageToLoad("30000"); - - // Verify preferences saved successfully - $this->assertEquals("Your preferences have been saved.", - $this->getText("//div[@id='bodyContent']/div[4]/strong/p")); - } -} - |