Web tests fix for membership.
[civicrm-core.git] / tests / phpunit / WebTest / Member / OnlineMembershipCreateTest.php
index ebec674230375414e528aacd6fcbd282787f7ec2..a155793b6a1067359c96d726bd0e0a272fe877fb 100644 (file)
@@ -94,12 +94,12 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase {
     // create two new membership types
     $memTypeParams1 = $this->webtestAddMembershipType();
     $memTypeTitle1 = $memTypeParams1['membership_type'];
-    $memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href"));
+    $memTypeId1 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[1][text()='{$memTypeTitle1}']/../td[12]/span/a[3]@href"));
     $memTypeId1 = $memTypeId1[1];
 
     $memTypeParams2 = $this->webtestAddMembershipType();
     $memTypeTitle2 = $memTypeParams2['membership_type'];
-    $memTypeId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/div[1]/table/tbody//tr/td[text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href"));
+    $memTypeId2 = explode('&id=', $this->getAttribute("xpath=//div[@id='membership_type']/table/tbody//tr/td[1][text()='{$memTypeTitle2}']/../td[12]/span/a[3]@href"));
     $memTypeId2 = $memTypeId2[1];
 
     // edit contribution page memberships tab to add two new membership types
@@ -146,9 +146,9 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase {
     $this->webtestVerifyTabularData($verifyData);
 
     // Click View action link on associated contribution record
-    $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
-    $this->click("xpath=//form[@id='MembershipView']/div[2]/div/table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
-    $this->waitForElementPresent("_qf_ContributionView_cancel-bottom");
+    $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[1][text()='View']");
+    $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[1][text()='View']");
+    $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[3]/span[2]");
     //View Contribution Record
     $verifyData = array(
       'From' => $firstName . ' ' . $lastName,
@@ -213,11 +213,13 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase {
       $this->click("xpath=//div[@class='crm-section payment_processor-section']/div[2]//label[text()='Pay later label {$hash}']");
     }
     $this->type("email-5", $firstName . "@example.com");
-
+    $this->waitForElementPresent("first_name");
     $this->type("first_name", $firstName);
+    $this->waitForElementPresent("last_name");
     $this->type("last_name", $lastName);
 
     $streetAddress = "100 Main Street";
+    $this->waitForElementPresent("street_address-1");
     $this->type("street_address-1", $streetAddress);
     $this->type("city-1", "San Francisco");
     $this->type("postal_code-1", "94117");
@@ -232,7 +234,9 @@ class WebTest_Member_OnlineMembershipCreateTest extends CiviSeleniumTestCase {
       $this->select("credit_card_exp_date[Y]", "value=2020");
 
       //Billing Info
+      $this->waitForElementPresent("billing_first_name");
       $this->type("billing_first_name", $firstName . "billing");
+      $this->waitForElementPresent("billing_last_name");
       $this->type("billing_last_name", $lastName . "billing");
       $this->type("billing_street_address-5", "15 Main St.");
       $this->type(" billing_city-5", "San Jose");