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