summaryrefslogtreecommitdiff
path: root/tests/selenium/suites/MovePageTestCase.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
commit91e194556c52d2f354344f930419eef2dd6267f0 (patch)
tree0cd12490d3cd3499274017c9b799d0f738d3719e /tests/selenium/suites/MovePageTestCase.php
parent08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (diff)
Update to MediaWiki 1.21.2
Diffstat (limited to 'tests/selenium/suites/MovePageTestCase.php')
-rw-r--r--tests/selenium/suites/MovePageTestCase.php111
1 files changed, 111 insertions, 0 deletions
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 );
+ }
+}
+