X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fselenium%2FSeleniumTestCase.php;h=a2676caf2bbab3bca1618ed0f300e44eacb0d248;hb=50e7985d4d5e9f70bd27e61d84d43514004f23da;hp=7976c16a0b9af5c432d8afd145eb88c36b1af42a;hpb=3662ccd94909e5cb9b11efe550716e99493732c2;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/selenium/SeleniumTestCase.php b/tests/selenium/SeleniumTestCase.php index 7976c16a0b..a2676caf2b 100644 --- a/tests/selenium/SeleniumTestCase.php +++ b/tests/selenium/SeleniumTestCase.php @@ -1,5 +1,5 @@ type( SeleniumTestConstants::INPUT_SEARCH_BOX, $pageName ); + $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $pageName ); $this->click( SeleniumTestConstants::BUTTON_SEARCH ); $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); $this->click( SeleniumTestConstants::LINK_START . $pageName ); $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); - $location = $this->getLocation() . "\n"; - if ( strpos( $location, '&redlink=1') !== false ) { - $this->type( SeleniumTestConstants::TEXT_EDITOR, "Test fixture page. No real content here" ); + $location = $this->getLocation() . "\n"; + if ( strpos( $location, '&redlink=1' ) !== false ) { + $this->type( SeleniumTestConstants::TEXT_EDITOR, "Test fixture page. No real content here" ); $this->click( SeleniumTestConstants::BUTTON_SAVE ); $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); $this->assertTrue( $this->isTextPresent( $pageName ), - $this->getText( SeleniumTestConstants::TEXT_PAGE_HEADING ) ); + $this->getText( SeleniumTestConstants::TEXT_PAGE_HEADING ) ); } } - + /** * Create a test page using date as part of the name so that it is unique * @param $pagePrefix The prefix to use for the page name. The current date will be appended to this to make it unique * @param $watchThis Whether to add the page to my watchlist. Defaults to false. */ function createNewTestPage( $pagePrefix, $watchThis = false ) { - $pageName = $pagePrefix . date("Ymd-His"); - $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $pageName ); + $pageName = $pagePrefix . date( "Ymd-His" ); + $this->type( SeleniumTestConstants::INPUT_SEARCH_BOX, $pageName ); $this->click( SeleniumTestConstants::BUTTON_SEARCH ); $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); $this->click( SeleniumTestConstants::LINK_START . $pageName ); $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); - $location = $this->getLocation() . "\n"; - $this->assertContains( '&redlink=1', $location ). - $this->type( SeleniumTestConstants::TEXT_EDITOR, "Test fixture page. No real content here" ); + $location = $this->getLocation() . "\n"; + $this->assertContains( '&redlink=1', $location ) . + $this->type( SeleniumTestConstants::TEXT_EDITOR, "Test fixture page. No real content here" ); if ( $watchThis ) { $this->click( "wpWatchthis" ); } $this->click( SeleniumTestConstants::BUTTON_SAVE ); $this->waitForPageToLoad( SeleniumTestConstants::WIKI_TEST_WAIT_TIME ); $this->assertTrue( $this->isTextPresent( $pageName ), - $this->getText( SeleniumTestConstants::TEXT_PAGE_HEADING ) ); + $this->getText( SeleniumTestConstants::TEXT_PAGE_HEADING ) ); return $pageName; } - public function getExistingPage(){ + public function getExistingPage() { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->type("searchInput", "new" ); - $this->click("searchGoButton"); - $this->waitForPageToLoad("30000"); + $this->type( "searchInput", "new" ); + $this->click( "searchGoButton" ); + $this->waitForPageToLoad( "30000" ); } - public function getNewPage($pageName){ + 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"); + $this->type( "searchInput", $pageName ); + $this->click( "searchGoButton" ); + $this->waitForPageToLoad( "30000" ); + $this->click( "link=" . $pageName ); + $this->waitForPageToLoad( "600000" ); } + // Loading the mediawiki editor - public function loadWikiEditor(){ + 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", ""); + public function clearWikiEditor() { + $this->type( "wpTextbox1", "" ); } // Click on the 'Show preview' button of the mediawiki editor - public function clickShowPreviewBtn(){ - $this->click("wpPreview"); + public function clickShowPreviewBtn() { + $this->click( "wpPreview" ); } // Click on the 'Save Page' button of the mediawiki editor - public function clickSavePageBtn(){ - $this->click("wpSave"); + public function clickSavePageBtn() { + $this->click( "wpSave" ); } // Click on the 'Edit' link - public function clickEditLink(){ - $this->click("link=Edit"); - $this->waitForPageToLoad("30000"); + public function clickEditLink() { + $this->click( "link=Edit" ); + $this->waitForPageToLoad( "30000" ); } - }