From b21dd8158fe31da91b6421d8ed66b301c3f749fd Mon Sep 17 00:00:00 2001 From: Rohan Katkar Date: Wed, 17 Dec 2014 19:01:55 +0530 Subject: [PATCH] Fix for Webtest --- .../WebTest/Contribute/ContributionPageAddTest.php | 13 ++++++++----- .../WebTest/Member/OnlineMembershipCreateTest.php | 2 +- .../WebTest/Member/OnlineMembershipRenewTest.php | 12 ++++++------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php index 401b2e508b..20eab9455b 100644 --- a/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php +++ b/tests/phpunit/WebTest/Contribute/ContributionPageAddTest.php @@ -57,8 +57,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $texts = array( "Title - New Membership $hash", "This is introductory message for $pageTitle", - '$ 50.00 Student', - "$ $rand.00 Label $hash", + 'Student - $ 50.00', + "Label $hash - $ $rand.00", "Pay later label $hash", 'Organization Details', 'Other Amount', @@ -68,6 +68,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { ); foreach ($texts as $text) { $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); + $this->waitForAjaxContent(); } // Disable and re-enable Other Amounts (verify fix for CRM-15021) @@ -125,8 +126,8 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $texts = array( "Title - New Membership $hash", "This is introductory message for $pageTitle", - '$ 50.00 Student', - "$ $rand.00 Label $hash", + 'Student - $ 50.00', + "Label $hash - $ $rand.00", "Pay later label $hash", 'Organization Details', 'Other Amount', @@ -136,6 +137,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { ); foreach ($texts as $text) { $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); + $this->waitForAjaxContent(); } } @@ -171,7 +173,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { $texts = array( "Title - New Membership $hash", "This is introductory message for $pageTitle", - "$ $rand.00 Label $hash", + "Label $hash - $ $rand.00", "Pay later label $hash", 'Organization Details', 'Other Amount', @@ -181,6 +183,7 @@ class WebTest_Contribute_ContributionPageAddTest extends CiviSeleniumTestCase { ); foreach ($texts as $text) { $this->assertTrue($this->isTextPresent($text), 'Missing text: ' . $text); + $this->waitForAjaxContent(); } } diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php index 85342bfb95..8c474032e0 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipCreateTest.php @@ -196,7 +196,7 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase { // Select membership type 1 $this->waitForElementPresent("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label"); if ($memTypeId != 'No thank you') { - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$memTypeId')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//div/span/label/span[1][contains(text(),'$memTypeId')]"); } else { diff --git a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php index c377eb8dbf..2704d3e175 100644 --- a/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OnlineMembershipRenewTest.php @@ -101,7 +101,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { //Go to online membership signup page $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom"); - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div[2]/span/label/span[1][contains(text(),'Student')]"); //Type first name and last name and email $this->type("first_name", $firstName); @@ -158,7 +158,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom"); - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div[2]/span/label/span[1][contains(text(),'Student')]"); //Type first name and last name and email $this->type("first_name", $firstName); @@ -270,7 +270,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { //Go to online membership signup page $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom"); - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'General')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div[1]/span/label/span[1][contains(text(),'General')]"); //Type first name and last name $this->type("first_name", $firstName); $this->type("last_name", $lastName); @@ -322,7 +322,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { ); } $this->openCiviPage("contribute/transact", "reset=1&id=2", "_qf_Main_upload-bottom"); - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'Student')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div[2]/span/label/span[1][contains(text(),'Student')]"); //Credit Card Info $this->select("credit_card_type", "value=Visa"); @@ -479,7 +479,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { //get Url for Live Contribution Page $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", '_qf_Main_upload-bottom'); - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$membershipTypeTitle')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div/span/label/span[1][contains(text(),'$membershipTypeTitle')]"); $firstName = 'Eia' . substr(sha1(rand()), 0, 4); $lastName = 'Ande' . substr(sha1(rand()), 0, 4); $name = $firstName . ' ' . $lastName; @@ -574,7 +574,7 @@ class WebTest_Member_OnlineMembershipRenewTest extends CiviSeleniumTestCase { $this->openCiviPage("contribute/transact", "reset=1&id=$pageId", "_qf_Main_upload-bottom"); - $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]//span/label/span[2][contains(text(),'$membershipTypeTitle')]"); + $this->click("xpath=//div[@class='crm-section membership_amount-section']/div[2]/div/span/label/span[1][contains(text(),'$membershipTypeTitle')]"); $this->type("email-5", $email); $this->click('is_for_organization'); $this->type('onbehalf_organization_name', $organisationName); -- 2.25.1