MediaWiki  REL1_21
DeletePageAdminTestCase.php
Go to the documentation of this file.
00001 <?php
00026 class DeletePageAdminTestCase extends SeleniumTestCase {
00027         // Verify adding a new page
00028         public function testDeletePage() {
00029 
00030                 $newPage = "new";
00031                 $displayName = "New";
00032 
00033                 $this->open( $this->getUrl() . '/index.php?title=Main_Page' );
00034 
00035                 $this->type( "searchInput", $newPage );
00036                 $this->click( "searchGoButton" );
00037                 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00038                 $this->click( SeleniumTestConstants::LINK_START . $displayName );
00039                 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00040                 $this->type( SeleniumTestConstants::TEXT_EDITOR, $newPage . " text" );
00041                 $this->click( SeleniumTestConstants::BUTTON_SAVE );
00042 
00043                 $this->open( $this->getUrl() .
00044                         '/index.php?title=Main_Page&action=edit' );
00045                 $this->click( SeleniumTestConstants::LINK_START . "Log out" );
00046                 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00047                 $this->click( SeleniumTestConstants::LINK_START . "Log in / create account" );
00048                 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00049 
00050                 $this->type( "wpName1", $this->selenium->getUser() );
00051                 $this->type( "wpPassword1", $this->selenium->getPass() );
00052                 $this->click( "wpLoginAttempt" );
00053                 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00054                 $this->type( "searchInput", "new" );
00055                 $this->click( "searchGoButton" );
00056                 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00057 
00058                 // Verify  'Delete' link displayed
00059                 $source = $this->gettext( SeleniumTestConstants::LINK_START . "Delete" );
00060                 $correct = strstr( $source, "Delete" );
00061                 $this->assertEquals( $correct, true );
00062 
00063                 $this->click( SeleniumTestConstants::LINK_START . "Delete" );
00064                 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00065 
00066                 // Verify 'Delete' button available
00067                 $this->assertTrue( $this->isElementPresent( "wpConfirmB" ) );
00068 
00069                 $this->click( "wpConfirmB" );
00070                 $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00071 
00072                 // Verify  'Action complete' text displayed
00073                 $source = $this->gettext( "firstHeading" );
00074                 $correct = strstr( $source, "Action complete" );
00075                 $this->assertEquals( $correct, true );
00076 
00077                 // Verify  '<Page Name> has been deleted. See deletion log for a record of recent deletions.' text displayed
00078                 $source = $this->gettext( "//div[@id='bodyContent']/p[1]" );
00079                 $correct = strstr( $source, "\"New\" has been deleted. See deletion log for a record of recent deletions." );
00080                 $this->assertEquals( $correct, true );
00081         }
00082 }