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