From: nadeesha Date: Fri, 3 Dec 2010 14:12:52 +0000 (+0000) Subject: Add following common functions for selenium scripts. getExistingPage(), getNewPage... X-Git-Tag: 1.31.0-rc.0~33612 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=154be43459058579be6f1ec553d1b29f66f29573;p=lhc%2Fweb%2Fwiklou.git Add following common functions for selenium scripts. getExistingPage(), getNewPage($pageName), loadWikiEditor(), clearWikiEditor(), clickShowPreviewBtn(), clickSavePageBtn(), clickEditLink(), deletePage($pageName) --- diff --git a/maintenance/tests/selenium/SeleniumTestCase.php b/maintenance/tests/selenium/SeleniumTestCase.php index e30d5f301c..11e1b192ec 100644 --- a/maintenance/tests/selenium/SeleniumTestCase.php +++ b/maintenance/tests/selenium/SeleniumTestCase.php @@ -26,4 +26,78 @@ class SeleniumTestCase extends PHPUnit_Framework_TestCase { // PHPUnit_Extension $this->assertRegExp( "/$text/", $innerHTML ); } +//Common Funtions Added for Selenium Tests + + public function getExistingPage(){ + $this->open( $this->getUrl() . + '/index.php?title=Main_Page&action=edit' ); + $this->type("searchInput", "new" ); + $this->click("searchGoButton"); + $this->waitForPageToLoad("30000"); + } + + public function getNewPage($pageName){ + + $this->open( $this->getUrl() . + '/index.php?title=Main_Page&action=edit' ); + $this->type("searchInput", $pageName ); + $this->click("searchGoButton"); + $this->waitForPageToLoad("30000"); + $this->click("link=".$pageName); + $this->waitForPageToLoad("600000"); + + + } + // Loading the mediawiki editor + public function loadWikiEditor(){ + $this->open( $this->getUrl() . + '/index.php?title=Main_Page&action=edit' ); + } + + // Clear the content of the mediawiki editor + public function clearWikiEditor(){ + $this->type("wpTextbox1", ""); + } + + // Click on the 'Show preview' button of the mediawiki editor + public function clickShowPreviewBtn(){ + $this->click("wpPreview"); + } + + // Click on the 'Save Page' button of the mediawiki editor + public function clickSavePageBtn(){ + $this->click("wpSave"); + } + + // Click on the 'Edit' link + public function clickEditLink(){ + $this->click("link=Edit"); + $this->waitForPageToLoad("30000"); + } + + public function deletePage($pageName){ + $isLinkPresent = False; + $this->open( $this->getUrl() . + '/index.php?title=Main_Page&action=edit' ); + $this->click("link=Log out"); + $this->waitForPageToLoad( "30000" ); + $this->click( "link=Log in / create account" ); + $this->waitForPageToLoad( "30000" ); + $this->type( "wpName1", "nadeesha" ); + $this->type( "wpPassword1", "12345" ); + $this->click( "wpLoginAttempt" ); + $this->waitForPageToLoad( "30000" ); + $this->type( "searchInput", $pageName ); + $this->click( "searchGoButton"); + $this->waitForPageToLoad( "30000" ); + + $this->click( "link=Delete" ); + $this->waitForPageToLoad( "30000" ); + $this->click( "wpConfirmB" ); + $this->waitForPageToLoad( "30000" ); + + } + + + }