MediaWiki  REL1_19
AddNewPageTestCase.php
Go to the documentation of this file.
00001 <?php
00002 
00031 class AddNewPageTestCase extends SeleniumTestCase {
00032 
00033     // Verify adding a new page
00034     public function testAddNewPage() {
00035         $newPage = "new";
00036         $displayName = "New";
00037         $this->open( $this->getUrl() .
00038                 '/index.php?title=Main_Page&action=edit' );
00039         $this->type( "searchInput", $newPage );
00040         $this->click( "searchGoButton" );
00041         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00042 
00043         // Verify 'Search results' text available
00044         $source = $this->gettext( "firstHeading" );
00045         $correct = strstr( $source, "Search results" );
00046         $this->assertEquals( $correct, true);
00047 
00048         // Verify  'Create the page "<page name>" on this wiki' text available
00049         $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" );
00050         $correct = strstr ( $source, "Create the page \"New\" on this wiki!" );
00051         $this->assertEquals( $correct, true );
00052 
00053         $this->click( SeleniumTestConstants::LINK_START.$displayName );
00054         $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME );
00055 
00056         $this->assertTrue($this->isElementPresent( SeleniumTestConstants::LINK_START."Create" ));
00057         $this->type( "wpTextbox1", "add new test page" );
00058         $this->click( SeleniumTestConstants::BUTTON_SAVE );
00059 
00060         // Verify new page added
00061         $source = $this->gettext( "firstHeading" );
00062         $correct = strstr ( $source, $displayName );
00063         $this->assertEquals( $correct, true );
00064     }
00065 }