From 2fe8e12075def853ab72d0ae9e1109206354e9cd Mon Sep 17 00:00:00 2001 From: nadeesha Date: Fri, 31 Dec 2010 10:05:15 +0000 Subject: [PATCH] Change the values taken from the SeleniumTestConstants.php --- .../suites/AddContentToNewPageTestCase.php | 26 ++++---- tests/selenium/suites/AddNewPageTestCase.php | 10 +-- .../selenium/suites/CreateAccountTestCase.php | 22 +++---- .../suites/DeletePageAdminTestCase.php | 30 ++++----- .../selenium/suites/EmailPasswordTestCase.php | 22 +++---- tests/selenium/suites/MovePageTestCase.php | 24 +++---- tests/selenium/suites/MyWatchListTestCase.php | 10 +-- tests/selenium/suites/PageSearchTestCase.php | 36 +++++------ tests/selenium/suites/PreviewPageTestCase.php | 2 +- tests/selenium/suites/SavePageTestCase.php | 6 +- .../suites/UserPreferencesTestCase.php | 64 +++++++++---------- 11 files changed, 126 insertions(+), 126 deletions(-) diff --git a/tests/selenium/suites/AddContentToNewPageTestCase.php b/tests/selenium/suites/AddContentToNewPageTestCase.php index 00f76caf8f..7c22135219 100644 --- a/tests/selenium/suites/AddContentToNewPageTestCase.php +++ b/tests/selenium/suites/AddContentToNewPageTestCase.php @@ -40,7 +40,7 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { $this->clearWikiEditor(); $this->click( "//*[@id='mw-editbutton-bold']" ); $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify bold text displayed on mediawiki preview $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/p/b" )); @@ -56,7 +56,7 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { $this->clearWikiEditor(); $this->click( "//*[@id='mw-editbutton-italic']" ); $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify italic text displayed on mediawiki preview $this->assertTrue($this->isElementPresent("//div[@id='wikiPreview']/p/i")); @@ -71,15 +71,15 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { $this->clearWikiEditor(); $this->click( "//*[@id='mw-editbutton-link']" ); $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify internal link displayed on mediawiki preview $source = $this->getText( "//*[@id='wikiPreview']/p/a" ); $correct = strstr( $source, "Link title" ); $this->assertEquals( $correct, true ); - $this->click( "link=Link title" ); - $this->waitForPageToLoad( "600000" ); + $this->click( LINK_START."Link title" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify internal link open as a new page - editing mode $source = $this->getText( "firstHeading" ); @@ -94,17 +94,17 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { $this->loadWikiEditor(); $this->clearWikiEditor(); $this->click( "//*[@id='mw-editbutton-extlink']" ); - $this->type( "wpTextbox1", "[http://www.google.com Google]" ); + $this->type( TEXT_EDITOR, "[http://www.google.com Google]" ); $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify external links displayed on mediawiki preview $source = $this->getText( "//*[@id='wikiPreview']/p/a" ); $correct = strstr( $source, "Google" ); $this->assertEquals( $correct, true ); - $this->click( "link=Google" ); - $this->waitForPageToLoad( "600000" ); + $this->click( LINK_START."Google" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify external link opens $source = $this->getTitle(); @@ -122,7 +122,7 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { $this->clearWikiEditor(); $this->click( "mw-editbutton-headline" ); $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertTrue($this->isElementPresent( "//div[@id='wikiPreview']/h2" )); // Verify level 2 headline displayed on mediawiki preview @@ -139,7 +139,7 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { $this->clearWikiEditor(); $this->click( "//*[@id='mw-editbutton-nowiki']" ); $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify ignore wiki format text displayed on mediawiki preview $source = $this->getText( "//div[@id='wikiPreview']/p" ); @@ -155,7 +155,7 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { $this->clearWikiEditor(); $this->click( "mw-editbutton-signature" ); $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify signature displayed on mediawiki preview $source = $this->getText( "//*[@id='wikiPreview']/p/a" ); @@ -173,7 +173,7 @@ class AddContentToNewPageTestCase extends SeleniumTestCase { $this->click( "mw-editbutton-hr" ); $this->clickShowPreviewBtn(); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify horizontal line displayed on mediawiki preview $this->assertTrue( $this->isElementPresent( "//div[@id='wikiPreview']/hr" )); diff --git a/tests/selenium/suites/AddNewPageTestCase.php b/tests/selenium/suites/AddNewPageTestCase.php index e21938af2a..1caebdaad8 100644 --- a/tests/selenium/suites/AddNewPageTestCase.php +++ b/tests/selenium/suites/AddNewPageTestCase.php @@ -38,7 +38,7 @@ class AddNewPageTestCase extends SeleniumTestCase { '/index.php?title=Main_Page&action=edit' ); $this->type( "searchInput", $newPage ); $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify 'Search results' text available $source = $this->gettext( "firstHeading" ); @@ -50,12 +50,12 @@ class AddNewPageTestCase extends SeleniumTestCase { $correct = strstr ( $source, "Create the page \"New\" on this wiki!" ); $this->assertEquals( $correct, true ); - $this->click( "link=".$displayName ); - $this->waitForPageToLoad( "600000" ); + $this->click( LINK_START.$displayName ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); - $this->assertTrue($this->isElementPresent( "link=Create" )); + $this->assertTrue($this->isElementPresent( LINK_START."Create" )); $this->type( "wpTextbox1", "add new test page" ); - $this->click( "wpSave" ); + $this->click( BUTTON_SAVE ); // Verify new page added $source = $this->gettext( "firstHeading" ); diff --git a/tests/selenium/suites/CreateAccountTestCase.php b/tests/selenium/suites/CreateAccountTestCase.php index fbbcb2233a..47691d0f64 100644 --- a/tests/selenium/suites/CreateAccountTestCase.php +++ b/tests/selenium/suites/CreateAccountTestCase.php @@ -37,7 +37,7 @@ Class CreateAccountTestCase extends SeleniumTestCase { public function testMainPageLink() { $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->open( $this->getUrl().'/index.php?title=Main_Page' ); $this->assertTrue($this->isElementPresent( "link=Log in / create account" )); @@ -47,13 +47,13 @@ Class CreateAccountTestCase extends SeleniumTestCase { public function testCreateAccountPageLink() { $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->open( $this->getUrl().'/index.php?title=Main_Page' ); // click Log in / create account link to open Log in / create account' page $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertTrue($this->isElementPresent( "link=Create an account" )); } @@ -61,27 +61,27 @@ Class CreateAccountTestCase extends SeleniumTestCase { public function testCreateAccount() { $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->open( $this->getUrl().'/index.php?title=Main_Page' ); $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->click( "link=Create an account" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify for blank user name $this->type( "wpName2", "" ); $this->click( "wpCreateaccount" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "Login error\n You have not specified a valid user name.", $this->getText( "//div[@id='bodyContent']/div[4]" )); // Verify for invalid user name $this->type( "wpName2", "@" ); $this->click("wpCreateaccount" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "Login error\n You have not specified a valid user name.", $this->getText( "//div[@id='bodyContent']/div[4]" )); @@ -89,14 +89,14 @@ Class CreateAccountTestCase extends SeleniumTestCase { $this->type( "wpName2", $this->userName); $this->type( "wpPassword2", "" ); $this->click( "wpCreateaccount" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "Login error\n Passwords must be at least 1 character.", $this->getText("//div[@id='bodyContent']/div[4]" )); $this->type( "wpName2", $this->userName ); $this->type( "wpPassword2", $this->password ); $this->click( "wpCreateaccount" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "Login error\n The passwords you entered do not match.", $this->getText( "//div[@id='bodyContent']/div[4]" )); @@ -104,7 +104,7 @@ Class CreateAccountTestCase extends SeleniumTestCase { $this->type( "wpPassword2", $this->password ); $this->type( "wpRetype", $this->password ); $this->click( "wpCreateaccount" ); - $this->waitForPageToLoad( "30000 "); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify successful account creation for valid combination of 'Username', 'Password', 'Retype password' $this->assertEquals( "Welcome, ".ucfirst( $this->userName )."!", diff --git a/tests/selenium/suites/DeletePageAdminTestCase.php b/tests/selenium/suites/DeletePageAdminTestCase.php index b8d3866e76..c356811daa 100644 --- a/tests/selenium/suites/DeletePageAdminTestCase.php +++ b/tests/selenium/suites/DeletePageAdminTestCase.php @@ -41,40 +41,40 @@ class DeletePageAdminTestCase extends SeleniumTestCase { $this->type( "searchInput", $newPage ); $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=".$displayName ); - $this->waitForPageToLoad( "60000" ); - $this->type( "wpTextbox1", $newPage." text" ); - $this->click( "wpSave" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); + $this->click( LINK_START.$displayName ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); + $this->type( TEXT_EDITOR, $newPage." text" ); + $this->click( BUTTON_SAVE ); $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->click( LINK_START."Log out" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); + $this->click( LINK_START."Log in / create account" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->type( "wpName1", $this->selenium->getUser() ); $this->type( "wpPassword1", $this->selenium->getPass() ); $this->click( "wpLoginAttempt" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->type( "searchInput", "new" ); $this->click( "searchGoButton"); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify 'Delete' link displayed - $source = $this->gettext( "link=Delete" ); + $source = $this->gettext( LINK_START."Delete" ); $correct = strstr ( $source, "Delete" ); $this->assertEquals($correct, true ); - $this->click( "link=Delete" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."Delete" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify 'Delete' button available $this->assertTrue($this->isElementPresent( "wpConfirmB" )); $this->click( "wpConfirmB" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify 'Action complete' text displayed $source = $this->gettext( "firstHeading" ); diff --git a/tests/selenium/suites/EmailPasswordTestCase.php b/tests/selenium/suites/EmailPasswordTestCase.php index 1a8f16cb09..17bf31abd1 100644 --- a/tests/selenium/suites/EmailPasswordTestCase.php +++ b/tests/selenium/suites/EmailPasswordTestCase.php @@ -34,38 +34,38 @@ class EmailPasswordTestCase extends SeleniumTestCase { public function testEmailPasswordButton() { - $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."Log out" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->open( $this->getUrl().'/index.php?title=Main_Page' ); // click Log in / create account link to open Log in / create account' page - $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."Log in / create account" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertTrue($this->isElementPresent( "wpMailmypassword" )); } // Verify Email password functionality public function testEmailPasswordMessages() { - $this->click( "link=Log out" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."Log out" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->open( $this->getUrl().'/index.php?title=Main_Page' ); // click Log in / create account link to open Log in / create account' page - $this->click( "link=Log in / create account" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."Log in / create account" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->type( "wpName1", "" ); $this->click( "wpMailmypassword" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "Login error\n You have not specified a valid user name.", $this->getText("//div[@id='bodyContent']/div[4]")); $this->type( "wpName1", $this->userName ); $this->click( "wpMailmypassword" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Can not run on localhost $this->assertEquals( "A new password has been sent to the e-mail address registered for ".ucfirst($this->userName).". Please log in again after you receive it.", @@ -73,7 +73,7 @@ class EmailPasswordTestCase extends SeleniumTestCase { $this->type( "wpName1", $this->userName ); $this->click( "wpMailmypassword" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "Login error\n A password reminder has already been sent, within the last 24 hours. To prevent abuse, only one password reminder will be sent per 24 hours.", $this->getText( "//div[@id='bodyContent']/div[4]" )); } diff --git a/tests/selenium/suites/MovePageTestCase.php b/tests/selenium/suites/MovePageTestCase.php index e66facad99..6bfcbe07ee 100644 --- a/tests/selenium/suites/MovePageTestCase.php +++ b/tests/selenium/suites/MovePageTestCase.php @@ -39,18 +39,18 @@ class MovePageTestCase extends SeleniumTestCase { '/index.php?title=Main_Page&action=edit' ); $this->type( "searchInput", $newPage ); $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->click( "link=".$displayName ); - $this->waitForPageToLoad( "60000" ); - $this->type( "wpTextbox1", $newPage." text" ); - $this->click( "wpSave" ); - $this->waitForPageToLoad( "60000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); + $this->type( TEXT_EDITOR, $newPage." text" ); + $this->click( BUTTON_SAVE ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify link 'Move' available $this->assertTrue($this->isElementPresent( "link=Move" )); $this->click( "link=Move" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify correct page name displayed under 'Move Page' field $this->assertEquals($displayName, @@ -64,7 +64,7 @@ class MovePageTestCase extends SeleniumTestCase { $this->type( "wpNewTitle", $displayName ); $this->click( "wpMove" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify warning message for the same source and destination titles $this->assertEquals( "Source and destination titles are the same; cannot move a page over itself.", @@ -73,7 +73,7 @@ class MovePageTestCase extends SeleniumTestCase { // Verify warning message for the blank title $this->type( "wpNewTitle", "" ); $this->click( "wpMove" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify warning message for the blank title $this->assertEquals( "The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.", @@ -82,13 +82,13 @@ class MovePageTestCase extends SeleniumTestCase { // Verify warning messages for the invalid titles $this->type( "wpNewTitle", "# < > [ ] | { }" ); $this->click( "wpMove" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "The requested page title was invalid, empty, or an incorrectly linked inter-language or inter-wiki title. It may contain one or more characters which cannot be used in titles.", $this->getText( "//div[@id='bodyContent']/p[4]/strong" )); $this->type( "wpNewTitle", $displayName."move" ); $this->click( "wpMove" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify move success message displayed correctly $this->assertEquals( "\"".$displayName."\" has been moved to \"".$displayName."move"."\"", @@ -96,14 +96,14 @@ class MovePageTestCase extends SeleniumTestCase { $this->type( "searchInput", $newPage."move" ); $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify search using new page name $this->assertEquals( $displayName."move", $this->getText( "firstHeading" )); $this->type( "searchInput", $newPage ); $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify search using old page name $redirectPageName = $this->getText( "//*[@id='contentSub']" ); diff --git a/tests/selenium/suites/MyWatchListTestCase.php b/tests/selenium/suites/MyWatchListTestCase.php index b3515dec45..971c75bc6e 100644 --- a/tests/selenium/suites/MyWatchListTestCase.php +++ b/tests/selenium/suites/MyWatchListTestCase.php @@ -36,21 +36,21 @@ class MyWatchListTestCase extends SeleniumTestCase { $pageName = $this->createNewTestPage( "MyWatchListTest", true ); // Verify link 'My Watchlist' available - $this->assertTrue( $this->isElementPresent( "link=Watchlist" ) ); + $this->assertTrue( $this->isElementPresent( LINK_START."Watchlist" ) ); - $this->click( "link=Watchlist" ); + $this->click( LINK_START."Watchlist" ); $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify newly added page to the watchlist is available - $this->assertEquals( $pageName, $this->getText( "link=".$pageName )); + $this->assertEquals( $pageName, $this->getText( LINK_START.$pageName )); - $this->click( "link=".$pageName ); + $this->click( LINK_START.$pageName ); $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->click( LINK_EDIT ); $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->click( "wpWatchthis" ); $this->click( BUTTON_SAVE ); - $this->assertFalse( $this->isElementPresent( "link=".$pageName ) ); + $this->assertFalse( $this->isElementPresent( LINK_START.$pageName ) ); //todo watch using the dropdown menu } } diff --git a/tests/selenium/suites/PageSearchTestCase.php b/tests/selenium/suites/PageSearchTestCase.php index 525326463f..24da01724a 100644 --- a/tests/selenium/suites/PageSearchTestCase.php +++ b/tests/selenium/suites/PageSearchTestCase.php @@ -34,9 +34,9 @@ class PageSearchTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->type( "searchInput", "calcey qa" ); + $this->type( INPUT_SEARCH_BOX, "calcey qa" ); $this->click( "searchGoButton" ); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify no page matched with the entered search text $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p/b" ); @@ -44,11 +44,11 @@ class PageSearchTestCase extends SeleniumTestCase { $this->assertEquals( $correct, true ); $this->click( "link=Calcey qa" ); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); - $this->type( "wpTextbox1", "Calcey QA team" ); + $this->type( TEXT_EDITOR , "Calcey QA team" ); $this->click( "wpSave" ); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); } @@ -57,9 +57,9 @@ class PageSearchTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->type( "searchInput", "Calcey web" ); - $this->click( "mw-searchButton" ); - $this->waitForPageToLoad( "30000" ); + $this->type( INPUT_SEARCH_BOX, "Calcey web" ); + $this->click( BUTTON_SEARCH ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify no page is available as the search text $source = $this->gettext( "//div[@id='bodyContent']/div[4]/p[2]/b" ); @@ -67,16 +67,16 @@ class PageSearchTestCase extends SeleniumTestCase { $this->assertEquals( $correct, true ); $this->click( "link=Calcey web" ); - $this->waitForPageToLoad( "600000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); - $this->type( "wpTextbox1", "Calcey web team" ); - $this->click( "wpSave" ); - $this->waitForPageToLoad( "600000" ); + $this->type( TEXT_EDITOR, "Calcey web team" ); + $this->click( BUTTON_SAVE ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify saved page is opened when the exact page name is given - $this->type( "searchInput", "Calcey web" ); - $this->click( "mw-searchButton" ); - $this->waitForPageToLoad( "30000" ); + $this->type( INPUT_SEARCH_BOX, "Calcey web" ); + $this->click( BUTTON_SEARCH ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify exact page matched with the entered search text using 'Search' button $source = $this->getText( "//*[@id='bodyContent']/div[4]/p/b" ); @@ -84,9 +84,9 @@ class PageSearchTestCase extends SeleniumTestCase { $this->assertEquals( $correct, true ); // Verify resutls available when partial page name is entered as the search text - $this->type( "searchInput", "Calcey" ); - $this->click( "mw-searchButton" ); - $this->waitForPageToLoad( "30000" ); + $this->type( INPUT_SEARCH_BOX, "Calcey" ); + $this->click( BUTTON_SEARCH ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify text avaialble in the search result under the page titles if($this->isElementPresent( "Page_title_matches" )) { diff --git a/tests/selenium/suites/PreviewPageTestCase.php b/tests/selenium/suites/PreviewPageTestCase.php index b0f04f4716..3a79fbc34f 100644 --- a/tests/selenium/suites/PreviewPageTestCase.php +++ b/tests/selenium/suites/PreviewPageTestCase.php @@ -36,7 +36,7 @@ class PreviewPageTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); $this->getNewPage( $newPage ); - $this->type( "wpTextbox1", $wikiText."" ); + $this->type( TEXT_EDITOR, $wikiText."" ); $this->assertTrue($this->isElementPresent( "//*[@id='wpPreview']" )); $this->click( "wpPreview" ); diff --git a/tests/selenium/suites/SavePageTestCase.php b/tests/selenium/suites/SavePageTestCase.php index a1f73f8ae8..80bb4ba8d1 100644 --- a/tests/selenium/suites/SavePageTestCase.php +++ b/tests/selenium/suites/SavePageTestCase.php @@ -37,11 +37,11 @@ class SavePageTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); $this->getNewPage($newPage); - $this->type("wpTextbox1", $wikiText); + $this->type( TEXT_EDITOR, $wikiText ); // verify 'Save' button available - $this->assertTrue($this->isElementPresent( "wpSave" )); - $this->click( "wpSave" ); + $this->assertTrue($this->isElementPresent( BUTTON_SAVE )); + $this->click( BUTTON_SAVE ); // Verify saved page available $source = $this->gettext( "firstHeading" ); diff --git a/tests/selenium/suites/UserPreferencesTestCase.php b/tests/selenium/suites/UserPreferencesTestCase.php index 4ad2ed4e72..bed2255cb3 100644 --- a/tests/selenium/suites/UserPreferencesTestCase.php +++ b/tests/selenium/suites/UserPreferencesTestCase.php @@ -34,8 +34,8 @@ class UserPreferencesTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."My preferences" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify correct username displayed in User Preferences $this->assertEquals( $this->getText( "//li[@id='pt-userpage']/a" ), @@ -51,38 +51,38 @@ class UserPreferencesTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."My preferences" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); - $this->click( "link=Change password" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."Change password" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->type( "wpPassword", "12345" ); $this->type( "wpNewPassword", "54321" ); $this->type( "wpRetype", "54321" ); $this->click( "//input[@value='Change password']" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "Preferences", $this->getText( "firstHeading" )); - $this->click( "link=Change password" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."Change password" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->type( "wpPassword", "54321" ); $this->type( "wpNewPassword", "12345" ); $this->type( "wpRetype", "12345" ); $this->click( "//input[@value='Change password']" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->assertEquals( "Preferences", $this->getText( "firstHeading" )); - $this->click( "link=Change password" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."Change password" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->type( "wpPassword", "54321" ); $this->type( "wpNewPassword", "12345" ); $this->type( "wpRetype", "12345" ); $this->click( "//input[@value='Change password']" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); } // Verify successful preferences save @@ -90,19 +90,19 @@ class UserPreferencesTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."My preferences" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->type( "mw-input-realname", "Test User" ); $this->click( "prefcontrol" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify "Your preferences have been saved." message $this->assertEquals( "Your preferences have been saved.", $this->getText( "//div[@id='bodyContent']/div[4]/strong/p" )); $this->type( "mw-input-realname", "" ); $this->click( "prefcontrol" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); } @@ -111,18 +111,18 @@ class UserPreferencesTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."My preferences" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->type( "mw-input-nickname", "TestSignature" ); $this->click( "prefcontrol" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify change user signature - $this->assertEquals( "TestSignature", $this->getText( "link=TestSignature" )); + $this->assertEquals( "TestSignature", $this->getText( LINK_START."TestSignature" )); $this->type( "mw-input-nickname", "Test" ); $this->click( "prefcontrol" ); - $this->waitForPageToLoad("30000"); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); } // Verify change date format @@ -131,15 +131,15 @@ class UserPreferencesTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); - $this->click( "link=Date and time" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."My preferences" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); + $this->click( LINK_START."Date and time" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); $this->click( "mw-input-date-dmy" ); $this->select( "mw-input-timecorrection", "label=Asia/Colombo" ); $this->click( "prefcontrol" ); - $this->waitForPageToLoad( "30000" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify Date format and time zome saved $this->assertEquals( "Your preferences have been saved.", @@ -151,15 +151,15 @@ class UserPreferencesTestCase extends SeleniumTestCase { $this->open( $this->getUrl() . '/index.php?title=Main_Page&action=edit' ); - $this->click( "link=My preferences" ); - $this->waitForPageToLoad( "30000" ); + $this->click( LINK_START."My preferences" ); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify restoring all default settings $this->assertEquals( "Restore all default settings", - $this->getText( "link=Restore all default settings" )); + $this->getText( LINK_START."Restore all default settings" )); $this->click("//*[@id='preferences']/div/a"); - $this->waitForPageToLoad("30000"); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify 'This can not be undone' warning message displayed $this->assertTrue($this->isElementPresent("//input[@value='Restore all default settings']")); @@ -169,7 +169,7 @@ class UserPreferencesTestCase extends SeleniumTestCase { $this->getText("//div[@id='bodyContent']/p")); $this->click("//input[@value='Restore all default settings']"); - $this->waitForPageToLoad("30000"); + $this->waitForPageToLoad( WIKI_TEST_WAIT_TIME ); // Verify preferences saved successfully $this->assertEquals("Your preferences have been saved.", -- 2.20.1