From 27c7ef423ce1b365ee27937683c46ec026427c63 Mon Sep 17 00:00:00 2001 From: Ravish Nair Date: Thu, 5 Sep 2013 20:09:49 +0530 Subject: [PATCH] -- webtest fixes and some inprovements based on the error on server --- tests/phpunit/WebTest/Contact/CustomDataAddTest.php | 4 ++-- tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php | 1 + tests/phpunit/WebTest/Contribute/OfflineContributionTest.php | 1 + tests/phpunit/WebTest/Contribute/OnlineContributionTest.php | 2 +- tests/phpunit/WebTest/Contribute/PCPAddTest.php | 2 +- tests/phpunit/WebTest/Member/InheritedMembershipTest.php | 3 ++- .../WebTest/Member/OfflineMembershipAddPricesetTest.php | 1 + .../WebTest/Member/OnlineMembershipAddPricesetTest.php | 1 + 8 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php index 87d4d0beee..80958a9f71 100644 --- a/tests/phpunit/WebTest/Contact/CustomDataAddTest.php +++ b/tests/phpunit/WebTest/Contact/CustomDataAddTest.php @@ -314,8 +314,8 @@ class WebTest_Contact_CustomDataAddTest extends CiviSeleniumTestCase { $this->waitForText('crm-notification-container', "{$firstName} {$lastName} has been created."); //Update the custom field - $this->click("css=a.edit.button"); - $this->waitForPageToLoad($this->getTimeoutMsec()); + $this->waitForElementPresent("xpath=//ul[@id='actions']/li[2]/a/span"); + $this->clickLink("xpath=//ul[@id='actions']/li[2]/a/span"); $this->click("xpath=//table//tr/td/label[text()=\"$customField\"]"); $value1 = "custom_1".rand(); $this->type("xpath=//table//tr/td/label[text()=\"$customField\"]/../following-sibling::td/input",$value1); diff --git a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php index 18630341e6..d8c76339af 100644 --- a/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php +++ b/tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php @@ -48,6 +48,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase { $cids[] = $this->urlArg('cid'); // update email of new contact + $this->waitForElementPresent("//ul[@id='actions']/li/a/span[text()='Edit']"); $this->click("//ul[@id='actions']/li/a/span[text()='Edit']"); $this->waitForPageToLoad($this->getTimeoutMsec()); $this->type("email_1_email", $emailString . $i . 'webtest'); diff --git a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php index e1c3755f44..32170daa4d 100644 --- a/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OfflineContributionTest.php @@ -173,6 +173,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase { 'Received Into' => $financialAccount, ); + $this->waitForElementPresent("xpath=/html/body/div[3]/div/div[2]/div/div[3]/div/div[2]/div/div/div/form/div[2]"); foreach ($expected as $value) { $this->verifyText("xpath=/html/body/div[3]/div/div[2]/div/div[3]/div/div[2]/div/div/div/form/div[2]", preg_quote($value)); } diff --git a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php index ab5c0a6cd1..face7e289c 100644 --- a/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php +++ b/tests/phpunit/WebTest/Contribute/OnlineContributionTest.php @@ -105,7 +105,7 @@ class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { $this->select("state_province-1", "value=1001"); // Honoree Info - $this->click("xpath=id('Main')/x:div[2]/x:fieldset/x:div[2]/x:div/x:label[text()='In Honor of']"); + $this->click("xpath=//form[@id='Main']/div[2]/fieldset/div[2]/div/input"); $this->waitForElementPresent("honor_email"); $this->select("honor_prefix_id", "label=Ms."); diff --git a/tests/phpunit/WebTest/Contribute/PCPAddTest.php b/tests/phpunit/WebTest/Contribute/PCPAddTest.php index 3dc94a2e4e..8d862cd457 100755 --- a/tests/phpunit/WebTest/Contribute/PCPAddTest.php +++ b/tests/phpunit/WebTest/Contribute/PCPAddTest.php @@ -137,7 +137,7 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase { $this->type("pcp_title", $pcpTitle); $this->type("pcp_intro_text", "Welcome Text $hash"); $this->type("goal_amount", $contributionAmount); - $this->click("_qf_Campaign_upload-bottom"); + $this->clickLink("_qf_Campaign_upload-bottom", '_qf_Main_upload-bottom'); $this->webtestLogin(); $this->openCiviPage("admin/pcp", "reset=1", "_qf_PCP_refresh"); diff --git a/tests/phpunit/WebTest/Member/InheritedMembershipTest.php b/tests/phpunit/WebTest/Member/InheritedMembershipTest.php index 4c4e0916ae..e89cb20a1a 100644 --- a/tests/phpunit/WebTest/Member/InheritedMembershipTest.php +++ b/tests/phpunit/WebTest/Member/InheritedMembershipTest.php @@ -391,7 +391,8 @@ class WebTest_Member_InheritedMembershipTest extends CiviSeleniumTestCase { $this->assertEquals(1, $this->getText("xpath=//li[@id='tab_rel']/a/em")); // Edit Contact but do not change any field - $this->clickLink("css=a.edit.button"); + $this->waitForElementPresent("xpath=//ul[@id='actions']/li[2]/a/span"); + $this->clickLink("xpath=//ul[@id='actions']/li[2]/a/span"); $this->waitForElementPresent('_qf_Contact_cancel-bottom'); $this->clickLink("_qf_Contact_upload_view-top"); diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php index ba368879ad..87ce08edc7 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php @@ -391,6 +391,7 @@ class WebTest_Member_OfflineMembershipAddPricesetTest extends CiviSeleniumTestCa $this->webtestVerifyTabularData($verifyData); //check if the membership amount is correct + $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[2]/tbody/tr/td/span[text()='{$amount}']"); $this->assertTrue($this->isElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[2]/tbody/tr/td/span[text()='{$amount}']")); $this->click("_qf_MembershipView_cancel-bottom"); $this->waitForPageToLoad($this->getTimeoutMsec()); diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php index db9b1925fc..5b248e07fe 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipAddPricesetTest.php @@ -479,6 +479,7 @@ class WebTest_Member_OnlineMembershipAddPricesetTest extends CiviSeleniumTestCas ); } //check if the membership amount is correct + $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[2]/tbody/tr/td/span[text()='{$amount}']"); $this->assertTrue($this->isElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[2]/tbody/tr/td/span[text()='{$amount}']")); } -- 2.25.1