MediaWiki  REL1_19
SavePageTestCase.php
Go to the documentation of this file.
00001 <?php
00002 
00030 class SavePageTestCase extends SeleniumTestCase {
00031 
00032     // Verify adding a new page
00033     public function testSavePage() {
00034         $wikiText = "Adding this page to test the Save button functionality";
00035         $newPage = "Test Save Page";
00036 
00037         $this->open( $this->getUrl() .
00038                 '/index.php?title=Main_Page&action=edit' );
00039         $this->getNewPage($newPage);
00040         $this->type( SeleniumTestConstants::TEXT_EDITOR, $wikiText );
00041 
00042         // verify 'Save' button available
00043         $this->assertTrue($this->isElementPresent( SeleniumTestConstants::BUTTON_SAVE ));
00044         $this->click( SeleniumTestConstants::BUTTON_SAVE );
00045 
00046         // Verify saved page available
00047         $source = $this->gettext( "firstHeading" );
00048         $correct = strstr( $source, "Test Save Page" );
00049 
00050         // Verify Saved page name displayed correctly
00051         $this->assertEquals( $correct, true );
00052 
00053         // Verify page content saved succesfully
00054         $contentOfSavedPage = $this->getText( "//*[@id='content']" );
00055         $this->assertContains( $wikiText, $contentOfSavedPage  );
00056         $this->deletePage( $newPage );
00057     }
00058 }