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