Webtests Fix for 4.6
authorWeb Access <rohan.katkar@webaccessglobal.com>
Mon, 11 May 2015 12:54:33 +0000 (18:24 +0530)
committerWeb Access <rohan.katkar@webaccessglobal.com>
Mon, 11 May 2015 12:54:33 +0000 (18:24 +0530)
tests/phpunit/WebTest/Event/AddPricesetTest.php
tests/phpunit/WebTest/Member/OfflineMembershipRenewTest.php

index 94d3e94fd808b39395a5f473cec37475cc816744..defe74336208f5e710c5728272f584d41f7a64dd 100644 (file)
@@ -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(
index 021e4c3214c22d355acf5d10aa044fcdcf386a87..5d853306d1c416d830601750684bed417d4aa48d 100644 (file)
@@ -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.