From eba7445eabd8eab8ac765c3549e1473a29e2c33a Mon Sep 17 00:00:00 2001 From: Web Access Date: Mon, 11 May 2015 18:24:33 +0530 Subject: [PATCH] Webtests Fix for 4.6 --- .../phpunit/WebTest/Event/AddPricesetTest.php | 4 ++-- .../Member/OfflineMembershipRenewTest.php | 18 +++++------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/tests/phpunit/WebTest/Event/AddPricesetTest.php b/tests/phpunit/WebTest/Event/AddPricesetTest.php index 94d3e94fd8..defe743362 100644 --- a/tests/phpunit/WebTest/Event/AddPricesetTest.php +++ b/tests/phpunit/WebTest/Event/AddPricesetTest.php @@ -622,9 +622,9 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase { // Is status message correct? $this->waitForText("crm-notification-container", "Event registration for $displayName has been added"); - $this->waitForElementPresent("xpath=//form[@class='CRM_Event_Form_Search crm-search-form']/table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->waitForElementPresent("xpath=//form[@id='Search']/table/tbody/tr[1]/td[8]/span/a[text()='View']"); //click through to the participant view screen - $this->click("xpath=//form[@class='CRM_Event_Form_Search crm-search-form']/table//tbody/tr[1]/td[8]/span/a[text()='View']"); + $this->click("xpath=//form[@id='Search']/table/tbody/tr[1]/td[8]/span/a[text()='View']"); $this->waitForElementPresent('_qf_ParticipantView_cancel-bottom'); $this->webtestVerifyTabularData( diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php index 021e4c3214..5d853306d1 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php @@ -354,7 +354,6 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // Let Start Date and End Date be auto computed // Record contribution - $this->click('record_contribution'); $this->waitForElementPresent('financial_type_id'); $this->select('financial_type_id', "label=Member Dues"); $this->select('payment_instrument_id', "label=Check"); @@ -363,20 +362,17 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { $this->select('contribution_status_id', "label=Completed"); $this->click('send_receipt'); - // Because it tends to cause problems, all uses of sleep() must be justified in comments - // Sleep should never be used for wait for anything to load from the server - // Justification for this instance: make sure onchange for total_amount has a chance to fire - sleep(2); + $this->waitForElementPresent('_qf_Membership_upload-bottom'); // Clicking save. $this->click('_qf_Membership_upload-bottom'); // page was loaded $this->waitForTextPresent($sourceText); + $endDate = $this->getText("xpath=//div[@id='memberships']//table/tbody/tr/td[4]"); // Is status message correct? - $this->waitForText('crm-notification-container', "{$membershipTypes['membership_type']} membership for $firstName Memberson has been added."); - $this->waitForText('crm-notification-container', "A membership confirmation and receipt has been sent to {$firstName}@memberson.com."); + $this->waitForText('crm-notification-container', "{$membershipTypes['membership_type']} membership for $firstName Memberson has been added. The new membership End Date is {$endDate}. A membership confirmation and receipt has been sent to {$firstName}@memberson.com."); $this->waitForElementPresent("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span[2][text()='more']/ul/li/a[text()='Renew']"); // click through to the Membership Renewal Link @@ -390,11 +386,7 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { $this->waitForElementPresent('num_terms'); $this->type('num_terms', ''); $this->type('num_terms', '2'); - - // Because it tends to cause problems, all uses of sleep() must be justified in comments - // Sleep should never be used for wait for anything to load from the server - // Justification for this instance: make sure onchange for total_amount has a chance to fire - sleep(2); + $this->waitForElementPresent('total_amount'); $this->click('total_amount'); $this->verifyValue('total_amount', "200.00"); $this->select('financial_type_id', "label=Member Dues"); @@ -415,7 +407,7 @@ class WebTest_Member_OfflineMembershipRenewTest extends CiviSeleniumTestCase { // click through to the membership view screen $this->click("xpath=//div[@id='memberships']//table/tbody/tr/td[9]/span/a[text()='View']"); - $this->waitForElementPresent('_qf_MembershipView_cancel-bottom'); + $this->waitForElementPresent("xpath=//button//span[contains(text(),'Done')]"); $joinDate = $startDate = date('F jS, Y', strtotime("-2 year")); // Adding 2 x 2 years renewal to initial membership. -- 2.25.1