summaryrefslogtreecommitdiff
path: root/tests/selenium/suites
diff options
context:
space:
mode:
Diffstat (limited to 'tests/selenium/suites')
-rw-r--r--tests/selenium/suites/AddContentToNewPageTestCase.php173
-rw-r--r--tests/selenium/suites/AddNewPageTestCase.php59
-rw-r--r--tests/selenium/suites/CreateAccountTestCase.php109
-rw-r--r--tests/selenium/suites/DeletePageAdminTestCase.php82
-rw-r--r--tests/selenium/suites/EmailPasswordTestCase.php74
-rw-r--r--tests/selenium/suites/MediaWikiEditorConfig.php41
-rw-r--r--tests/selenium/suites/MediaWikiEditorTestSuite.php19
-rw-r--r--tests/selenium/suites/MediaWikiExtraTestSuite.php21
-rw-r--r--tests/selenium/suites/MediawikiCoreSmokeTestCase.php70
-rw-r--r--tests/selenium/suites/MediawikiCoreSmokeTestSuite.php19
-rw-r--r--tests/selenium/suites/MovePageTestCase.php111
-rw-r--r--tests/selenium/suites/MyContributionsTestCase.php59
-rw-r--r--tests/selenium/suites/MyWatchListTestCase.php51
-rw-r--r--tests/selenium/suites/PageDeleteTestSuite.php15
-rw-r--r--tests/selenium/suites/PageSearchTestCase.php98
-rw-r--r--tests/selenium/suites/PreviewPageTestCase.php48
-rw-r--r--tests/selenium/suites/SavePageTestCase.php53
-rw-r--r--tests/selenium/suites/SimpleSeleniumConfig.php30
-rw-r--r--tests/selenium/suites/SimpleSeleniumTestCase.php39
-rw-r--r--tests/selenium/suites/SimpleSeleniumTestSuite.php26
-rw-r--r--tests/selenium/suites/UserPreferencesTestCase.php170
21 files changed, 1367 insertions, 0 deletions
diff --git a/tests/selenium/suites/AddContentToNewPageTestCase.php b/tests/selenium/suites/AddContentToNewPageTestCase.php
new file mode 100644
index 00000000..2803ff2a
--- /dev/null
+++ b/tests/selenium/suites/AddContentToNewPageTestCase.php
@@ -0,0 +1,173 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::LINK_START . "Link title" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::TEXT_EDITOR, "[http://www.google.com Google]" );
+ $this->clickShowPreviewBtn();
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify external links displayed on mediawiki preview
+ $source = $this->getText( "//*[@id='wikiPreview']/p/a" );
+ $correct = strstr( $source, "Google" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( SeleniumTestConstants::LINK_START . "Google" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify horizontal line displayed on mediawiki preview
+ $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" ) );
+ $this->deletePage( "new" );
+ }
+}
diff --git a/tests/selenium/suites/AddNewPageTestCase.php b/tests/selenium/suites/AddNewPageTestCase.php
new file mode 100644
index 00000000..c70af339
--- /dev/null
+++ b/tests/selenium/suites/AddNewPageTestCase.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::LINK_START . $displayName );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->assertTrue( $this->isElementPresent( SeleniumTestConstants::LINK_START . "Create" ) );
+ $this->type( "wpTextbox1", "add new test page" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+
+ // Verify new page added
+ $source = $this->gettext( "firstHeading" );
+ $correct = strstr( $source, $displayName );
+ $this->assertEquals( $correct, true );
+ }
+}
diff --git a/tests/selenium/suites/CreateAccountTestCase.php b/tests/selenium/suites/CreateAccountTestCase.php
new file mode 100644
index 00000000..a603f995
--- /dev/null
+++ b/tests/selenium/suites/CreateAccountTestCase.php
@@ -0,0 +1,109 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isElementPresent( "link=Create an account" ) );
+ }
+
+ // Verify Create account
+ public function testCreateAccount() {
+
+ $this->click( "link=Log out" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
+
+ $this->click( "link=Log in / create account" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->click( "link=Create an account" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify for blank user name
+ $this->type( "wpName2", "" );
+ $this->click( "wpCreateaccount" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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/tests/selenium/suites/DeletePageAdminTestCase.php b/tests/selenium/suites/DeletePageAdminTestCase.php
new file mode 100644
index 00000000..f0005cde
--- /dev/null
+++ b/tests/selenium/suites/DeletePageAdminTestCase.php
@@ -0,0 +1,82 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( SeleniumTestConstants::LINK_START . $displayName );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage . " text" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( SeleniumTestConstants::LINK_START . "Log out" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( "wpName1", $this->selenium->getUser() );
+ $this->type( "wpPassword1", $this->selenium->getPass() );
+ $this->click( "wpLoginAttempt" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( "searchInput", "new" );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify 'Delete' link displayed
+ $source = $this->gettext( SeleniumTestConstants::LINK_START . "Delete" );
+ $correct = strstr( $source, "Delete" );
+ $this->assertEquals( $correct, true );
+
+ $this->click( SeleniumTestConstants::LINK_START . "Delete" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify 'Delete' button available
+ $this->assertTrue( $this->isElementPresent( "wpConfirmB" ) );
+
+ $this->click( "wpConfirmB" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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/tests/selenium/suites/EmailPasswordTestCase.php b/tests/selenium/suites/EmailPasswordTestCase.php
new file mode 100644
index 00000000..77282e47
--- /dev/null
+++ b/tests/selenium/suites/EmailPasswordTestCase.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+class EmailPasswordTestCase extends SeleniumTestCase {
+ // change user name for each and every test (with in 24 hours)
+ private $userName = "test1";
+
+ public function testEmailPasswordButton() {
+ $this->click( SeleniumTestConstants::LINK_START . "Log out" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
+
+ // click Log in / create account link to open Log in / create account' page
+ $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->assertTrue( $this->isElementPresent( "wpMailmypassword" ) );
+ }
+
+ // Verify Email password functionality
+ public function testEmailPasswordMessages() {
+ $this->click( SeleniumTestConstants::LINK_START . "Log out" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
+
+ // click Log in / create account link to open Log in / create account' page
+ $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( "wpName1", "" );
+ $this->click( "wpMailmypassword" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $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/tests/selenium/suites/MediaWikiEditorConfig.php b/tests/selenium/suites/MediaWikiEditorConfig.php
new file mode 100644
index 00000000..7fd8e075
--- /dev/null
+++ b/tests/selenium/suites/MediaWikiEditorConfig.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+class MediaWikiEditorConfig {
+ public static function getSettings( &$includeFiles, &$globalConfigs ) {
+ $includes = array(
+ //files that needed to be included would go here
+ //commenting out because this does not exist
+ //'tests/selenium/suites/MediaWikiCommonFunction.php'
+ );
+ $configs = array(
+ 'wgPageLoadTime' => "600000"
+ );
+ $includeFiles = array_merge( $includeFiles, $includes );
+ $globalConfigs = array_merge( $globalConfigs, $configs );
+ return true;
+ }
+}
+
diff --git a/tests/selenium/suites/MediaWikiEditorTestSuite.php b/tests/selenium/suites/MediaWikiEditorTestSuite.php
new file mode 100644
index 00000000..f9cfb7fb
--- /dev/null
+++ b/tests/selenium/suites/MediaWikiEditorTestSuite.php
@@ -0,0 +1,19 @@
+<?php
+
+class MediaWikiEditorTestSuite extends SeleniumTestSuite {
+ public function setUp() {
+ $this->setLoginBeforeTests( true );
+ parent::setUp();
+ }
+
+ public function addTests() {
+ $testFiles = array(
+ 'tests/selenium/suites/AddNewPageTestCase.php',
+ 'tests/selenium/suites/AddContentToNewPageTestCase.php',
+ 'tests/selenium/suites/PreviewPageTestCase.php',
+ 'tests/selenium/suites/SavePageTestCase.php',
+ );
+ parent::addTestFiles( $testFiles );
+ }
+}
+
diff --git a/tests/selenium/suites/MediaWikiExtraTestSuite.php b/tests/selenium/suites/MediaWikiExtraTestSuite.php
new file mode 100644
index 00000000..8993907a
--- /dev/null
+++ b/tests/selenium/suites/MediaWikiExtraTestSuite.php
@@ -0,0 +1,21 @@
+<?php
+
+class MediaWikiExtraTestSuite extends SeleniumTestSuite {
+ public function setUp() {
+ $this->setLoginBeforeTests( true );
+ parent::setUp();
+ }
+
+ public function addTests() {
+ $testFiles = array(
+ 'tests/selenium/suites/MyContributionsTestCase.php',
+ 'tests/selenium/suites/MyWatchListTestCase.php',
+ 'tests/selenium/suites/UserPreferencesTestCase.php',
+ 'tests/selenium/suites/MovePageTestCase.php',
+ 'tests/selenium/suites/PageSearchTestCase.php',
+ 'tests/selenium/suites/EmailPasswordTestCase.php',
+ 'tests/selenium/suites/CreateAccountTestCase.php'
+ );
+ parent::addTestFiles( $testFiles );
+ }
+}
diff --git a/tests/selenium/suites/MediawikiCoreSmokeTestCase.php b/tests/selenium/suites/MediawikiCoreSmokeTestCase.php
new file mode 100644
index 00000000..4491afd2
--- /dev/null
+++ b/tests/selenium/suites/MediawikiCoreSmokeTestCase.php
@@ -0,0 +1,70 @@
+<?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', __DIR__ .
+ "\\..\\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/tests/selenium/suites/MediawikiCoreSmokeTestSuite.php b/tests/selenium/suites/MediawikiCoreSmokeTestSuite.php
new file mode 100644
index 00000000..fc69e3c3
--- /dev/null
+++ b/tests/selenium/suites/MediawikiCoreSmokeTestSuite.php
@@ -0,0 +1,19 @@
+<?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(
+ 'tests/selenium/suites/MediawikiCoreSmokeTestCase.php'
+ );
+ parent::addTestFiles( $testFiles );
+ }
+
+
+}
diff --git a/tests/selenium/suites/MovePageTestCase.php b/tests/selenium/suites/MovePageTestCase.php
new file mode 100644
index 00000000..d2eaa40d
--- /dev/null
+++ b/tests/selenium/suites/MovePageTestCase.php
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( "link=" . $displayName );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage . " text" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify link 'Move' available
+ $this->assertTrue( $this->isElementPresent( "link=Move" ) );
+
+ $this->click( "link=Move" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify search using new page name
+ $this->assertEquals( $displayName . "move", $this->getText( "firstHeading" ) );
+
+ $this->type( "searchInput", $newPage );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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/tests/selenium/suites/MyContributionsTestCase.php b/tests/selenium/suites/MyContributionsTestCase.php
new file mode 100644
index 00000000..81e3a4da
--- /dev/null
+++ b/tests/selenium/suites/MyContributionsTestCase.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+require_once dirname( __DIR__ ) . '/SeleniumTestConstants.php';
+
+class MyContributionsTestCase extends SeleniumTestCase {
+ // Verify user contributions
+ public function testRecentChangesAvailability() {
+ $newPage = $this->createNewTestPage( "MyContributionsTest" );
+
+ // Verify My contributions Link available
+ $this->assertTrue( $this->isElementPresent( "link=Contributions" ) );
+
+
+ $this->click( "link=Contributions" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify recent page adding available on My Contributions list
+ $this->assertEquals( $newPage, $this->getText( "link=" . $newPage ) );
+
+ $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $newPage );
+ $this->click( SeleniumTestConstants::BUTTON_SEARCH );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->click( SeleniumTestConstants::LINK_EDIT );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage . " text changed" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( "link=Contributions" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify recent page changes available on My Contributions
+ $this->assertTrue( $this->isTextPresent( $newPage ) );
+ }
+}
+
diff --git a/tests/selenium/suites/MyWatchListTestCase.php b/tests/selenium/suites/MyWatchListTestCase.php
new file mode 100644
index 00000000..842108fa
--- /dev/null
+++ b/tests/selenium/suites/MyWatchListTestCase.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+require_once dirname( __DIR__ ) . '/SeleniumTestConstants.php';
+
+class MyWatchListTestCase extends SeleniumTestCase {
+ // Verify user watchlist
+ public function testMyWatchlist() {
+ $pageName = $this->createNewTestPage( "MyWatchListTest", true );
+ // Verify link 'My Watchlist' available
+ $this->assertTrue( $this->isElementPresent( SeleniumTestConstants::LINK_START . "Watchlist" ) );
+
+ $this->click( SeleniumTestConstants::LINK_START . "Watchlist" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify newly added page to the watchlist is available
+ $this->assertEquals( $pageName, $this->getText( SeleniumTestConstants::LINK_START . $pageName ) );
+
+ $this->click( SeleniumTestConstants::LINK_START . $pageName );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( SeleniumTestConstants::LINK_EDIT );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( "wpWatchthis" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+ $this->assertFalse( $this->isElementPresent( SeleniumTestConstants::LINK_START . $pageName ) );
+ //todo watch using the dropdown menu
+ }
+}
+
diff --git a/tests/selenium/suites/PageDeleteTestSuite.php b/tests/selenium/suites/PageDeleteTestSuite.php
new file mode 100644
index 00000000..e43ffa80
--- /dev/null
+++ b/tests/selenium/suites/PageDeleteTestSuite.php
@@ -0,0 +1,15 @@
+<?php
+
+class PageDeleteTestSuite extends SeleniumTestSuite {
+ public function setUp() {
+ $this->setLoginBeforeTests( true );
+ parent::setUp();
+ }
+
+ public function addTests() {
+ $testFiles = array(
+ 'tests/selenium/suites/DeletePageAdminTestCase.php'
+ );
+ parent::addTestFiles( $testFiles );
+ }
+}
diff --git a/tests/selenium/suites/PageSearchTestCase.php b/tests/selenium/suites/PageSearchTestCase.php
new file mode 100644
index 00000000..5fdc5c80
--- /dev/null
+++ b/tests/selenium/suites/PageSearchTestCase.php
@@ -0,0 +1,98 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+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( SeleniumTestConstants::INPUT_SEARCH_BOX, "calcey qa" );
+ $this->click( "searchGoButton" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, "Calcey QA team" );
+ $this->click( "wpSave" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ }
+
+ // Verify the functionality of the 'Search' button
+ public function testPageSearchBtnSearch() {
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, "Calcey web" );
+ $this->click( SeleniumTestConstants::BUTTON_SEARCH );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( SeleniumTestConstants::TEXT_EDITOR, "Calcey web team" );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify saved page is opened when the exact page name is given
+ $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, "Calcey web" );
+ $this->click( SeleniumTestConstants::BUTTON_SEARCH );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::INPUT_SEARCH_BOX, "Calcey" );
+ $this->click( SeleniumTestConstants::BUTTON_SEARCH );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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/tests/selenium/suites/PreviewPageTestCase.php b/tests/selenium/suites/PreviewPageTestCase.php
new file mode 100644
index 00000000..036201f0
--- /dev/null
+++ b/tests/selenium/suites/PreviewPageTestCase.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+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( SeleniumTestConstants::TEXT_EDITOR, $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/tests/selenium/suites/SavePageTestCase.php b/tests/selenium/suites/SavePageTestCase.php
new file mode 100644
index 00000000..1e4cc2df
--- /dev/null
+++ b/tests/selenium/suites/SavePageTestCase.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+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( SeleniumTestConstants::TEXT_EDITOR, $wikiText );
+
+ // verify 'Save' button available
+ $this->assertTrue( $this->isElementPresent( SeleniumTestConstants::BUTTON_SAVE ) );
+ $this->click( SeleniumTestConstants::BUTTON_SAVE );
+
+ // 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/tests/selenium/suites/SimpleSeleniumConfig.php b/tests/selenium/suites/SimpleSeleniumConfig.php
new file mode 100644
index 00000000..a6935114
--- /dev/null
+++ b/tests/selenium/suites/SimpleSeleniumConfig.php
@@ -0,0 +1,30 @@
+<?php
+class SimpleSeleniumConfig {
+
+ public static function getSettings( &$includeFiles, &$globalConfigs, &$resourceFiles ) {
+ global $IP;
+ $includes = array(
+ //files that needed to be included would go here
+ );
+ $configs = array(
+ 'wgDBprefix' => 'mw_',
+ 'wgDBTableOptions' => 'ENGINE=InnoDB, DEFAULT CHARSET=binary',
+ 'wgDBmysql5' => 'false',
+ 'wgMainCacheType' => 'CACHE_NONE',
+ 'wgParserCacheType' => 'CACHE_NONE',
+ 'wgMemCachedServers' => array(),
+ 'wgLanguageCode' => 'en',
+ 'wgSitename' => 'test_wiki',
+ 'wgDefaultSkin' => 'chick'
+ );
+ $resources = array(
+ 'db' => "$IP/tests/selenium/data/SimpleSeleniumTestDB.sql",
+ 'images' => "$IP/tests/selenium/data/SimpleSeleniumTestImages.zip"
+ );
+
+ $includeFiles = array_merge( $includeFiles, $includes );
+ $globalConfigs = array_merge( $globalConfigs, $configs );
+ $resourceFiles = array_merge( $resourceFiles, $resources );
+ return true;
+ }
+}
diff --git a/tests/selenium/suites/SimpleSeleniumTestCase.php b/tests/selenium/suites/SimpleSeleniumTestCase.php
new file mode 100644
index 00000000..14c9e6b9
--- /dev/null
+++ b/tests/selenium/suites/SimpleSeleniumTestCase.php
@@ -0,0 +1,39 @@
+<?php
+/*
+ * This test case is part of the SimpleSeleniumTestSuite.
+ * Configuration for these tests are documented 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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' );
+ $bodyClass = $this->getAttribute( "//body/@class" );
+ $this->assertContains( 'skin-chick', $bodyClass, 'Chick skin not set' );
+ }
+
+ /**
+ * Just verify that the test db was loaded correctly
+ */
+ public function testDatabaseResourceLoadedCorrectly() {
+ $this->open( $this->getUrl() . '/index.php/TestResources?action=purge' );
+ $testString = $this->gettext( "//body//*[@id='firstHeading']" );
+ $this->assertEquals( 'TestResources', $testString, 'Article that should be present in the test db was not found.' );
+ }
+
+}
diff --git a/tests/selenium/suites/SimpleSeleniumTestSuite.php b/tests/selenium/suites/SimpleSeleniumTestSuite.php
new file mode 100644
index 00000000..446836a2
--- /dev/null
+++ b/tests/selenium/suites/SimpleSeleniumTestSuite.php
@@ -0,0 +1,26 @@
+<?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("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(
+ 'selenium/suites/SimpleSeleniumTestCase.php'
+ );
+ parent::addTestFiles( $testFiles );
+ }
+
+
+}
diff --git a/tests/selenium/suites/UserPreferencesTestCase.php b/tests/selenium/suites/UserPreferencesTestCase.php
new file mode 100644
index 00000000..c70e38fb
--- /dev/null
+++ b/tests/selenium/suites/UserPreferencesTestCase.php
@@ -0,0 +1,170 @@
+<?php
+/**
+ * Selenium server manager
+ *
+ * @file
+ * @ingroup Testing
+ * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
+ * http://www.calcey.com/
+ *
+ * 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
+ */
+
+class UserPreferencesTestCase extends SeleniumTestCase {
+ // Verify user information
+ public function testUserInfoDisplay() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( SeleniumTestConstants::LINK_START . "My preferences" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::LINK_START . "My preferences" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->click( SeleniumTestConstants::LINK_START . "Change password" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( "wpPassword", "12345" );
+ $this->type( "wpNewPassword", "54321" );
+ $this->type( "wpRetype", "54321" );
+ $this->click( "//input[@value='Change password']" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->assertEquals( "Preferences", $this->getText( "firstHeading" ) );
+
+ $this->click( SeleniumTestConstants::LINK_START . "Change password" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( "wpPassword", "54321" );
+ $this->type( "wpNewPassword", "12345" );
+ $this->type( "wpRetype", "12345" );
+ $this->click( "//input[@value='Change password']" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->assertEquals( "Preferences", $this->getText( "firstHeading" ) );
+
+ $this->click( SeleniumTestConstants::LINK_START . "Change password" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( "wpPassword", "54321" );
+ $this->type( "wpNewPassword", "12345" );
+ $this->type( "wpRetype", "12345" );
+ $this->click( "//input[@value='Change password']" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ }
+
+ // Verify successful preferences save
+ public function testSuccessfullSave() {
+
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( SeleniumTestConstants::LINK_START . "My preferences" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( "mw-input-realname", "Test User" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ }
+
+ // Verify change signature
+ public function testChangeSignature() {
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+ $this->click( SeleniumTestConstants::LINK_START . "My preferences" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->type( "mw-input-nickname", "TestSignature" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify change user signature
+ $this->assertEquals( "TestSignature", $this->getText( SeleniumTestConstants::LINK_START . "TestSignature" ) );
+ $this->type( "mw-input-nickname", "Test" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ }
+
+ // Verify change date format
+ public function testChangeDateFormatTimeZone() {
+ $this->open( $this->getUrl() .
+ '/index.php?title=Main_Page&action=edit' );
+
+ $this->click( SeleniumTestConstants::LINK_START . "My preferences" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+ $this->click( SeleniumTestConstants::LINK_START . "Date and time" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ $this->click( "mw-input-date-dmy" );
+ $this->select( "mw-input-timecorrection", "label=Asia/Colombo" );
+ $this->click( "prefcontrol" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::LINK_START . "My preferences" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify restoring all default settings
+ $this->assertEquals( "Restore all default settings",
+ $this->getText( SeleniumTestConstants::LINK_START . "Restore all default settings" ) );
+
+ $this->click( "//*[@id='preferences']/div/a" );
+ $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // 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( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
+
+ // Verify preferences saved successfully
+ $this->assertEquals( "Your preferences have been saved.",
+ $this->getText( "//div[@id='bodyContent']/div[4]/strong/p" ) );
+ }
+}
+