MediaWiki
REL1_21
|
00001 <?php 00026 class MovePageTestCase extends SeleniumTestCase { 00027 // Verify move(rename) wiki page 00028 public function testMovePage() { 00029 $newPage = "mypage99"; 00030 $displayName = "Mypage99"; 00031 00032 $this->open( $this->getUrl() . 00033 '/index.php?title=Main_Page&action=edit' ); 00034 $this->type( "searchInput", $newPage ); 00035 $this->click( "searchGoButton" ); 00036 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00037 $this->click( "link=" . $displayName ); 00038 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00039 $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage . " text" ); 00040 $this->click( SeleniumTestConstants::BUTTON_SAVE ); 00041 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00042 00043 // Verify link 'Move' available 00044 $this->assertTrue( $this->isElementPresent( "link=Move" ) ); 00045 00046 $this->click( "link=Move" ); 00047 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00048 00049 // Verify correct page name displayed under 'Move Page' field 00050 $this->assertEquals( $displayName, 00051 $this->getText( "//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a" ) ); 00052 $movePageName = $this->getText( "//table[@id='mw-movepage-table']/tbody/tr[1]/td[2]/strong/a" ); 00053 00054 // Verify 'To new title' field has current page name as the default name 00055 $newTitle = $this->getValue( "wpNewTitle" ); 00056 $correct = strstr( $movePageName, $newTitle ); 00057 $this->assertEquals( $correct, true ); 00058 00059 $this->type( "wpNewTitle", $displayName ); 00060 $this->click( "wpMove" ); 00061 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00062 00063 // Verify warning message for the same source and destination titles 00064 $this->assertEquals( "Source and destination titles are the same; cannot move a page over itself.", 00065 $this->getText( "//div[@id='bodyContent']/p[4]/strong" ) ); 00066 00067 // Verify warning message for the blank title 00068 $this->type( "wpNewTitle", "" ); 00069 $this->click( "wpMove" ); 00070 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00071 00072 // Verify warning message for the blank title 00073 $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.", 00074 $this->getText( "//div[@id='bodyContent']/p[4]/strong" ) ); 00075 00076 // Verify warning messages for the invalid titles 00077 $this->type( "wpNewTitle", "# < > [ ] | { }" ); 00078 $this->click( "wpMove" ); 00079 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00080 $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.", 00081 $this->getText( "//div[@id='bodyContent']/p[4]/strong" ) ); 00082 00083 $this->type( "wpNewTitle", $displayName . "move" ); 00084 $this->click( "wpMove" ); 00085 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00086 00087 // Verify move success message displayed correctly 00088 $this->assertEquals( "\"" . $displayName . "\" has been moved to \"" . $displayName . "move" . "\"", 00089 $this->getText( "//div[@id='bodyContent']/p[1]/b" ) ); 00090 00091 $this->type( "searchInput", $newPage . "move" ); 00092 $this->click( "searchGoButton" ); 00093 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00094 00095 // Verify search using new page name 00096 $this->assertEquals( $displayName . "move", $this->getText( "firstHeading" ) ); 00097 00098 $this->type( "searchInput", $newPage ); 00099 $this->click( "searchGoButton" ); 00100 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); 00101 00102 // Verify search using old page name 00103 $redirectPageName = $this->getText( "//*[@id='contentSub']" ); 00104 $this->assertEquals( "(Redirected from " . $displayName . ")", $redirectPageName ); 00105 00106 // newpage delete 00107 $this->deletePage( $newPage . "move" ); 00108 $this->deletePage( $newPage ); 00109 } 00110 } 00111