webtest fixes
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 10 Dec 2015 13:16:11 +0000 (18:46 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 10 Dec 2015 13:16:11 +0000 (18:46 +0530)
CRM/Contact/BAO/Contact.php
tests/phpunit/WebTest/Contribute/PCPAddTest.php
tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php
tests/phpunit/WebTest/Member/StandaloneAddTest.php
tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php

index 13c69e603d6e59c748409f8ebab0421845628ca1..b70957827da034840340d53db06abb483c9e9bce 100644 (file)
@@ -2529,8 +2529,10 @@ AND       civicrm_openid.is_primary = 1";
       $values['preferred_communication_method'] = $preffComm;
       $values['preferred_communication_method_display'] = CRM_Utils_Array::value('preferred_communication_method_display', $temp);
 
-      $preferredMailingFormat = CRM_Core_SelectValues::pmf();
-      $values['preferred_mail_format'] = $preferredMailingFormat[$contact->preferred_mail_format];
+      if ($contact->preferred_mail_format) {
+        $preferredMailingFormat = CRM_Core_SelectValues::pmf();
+        $values['preferred_mail_format'] = $preferredMailingFormat[$contact->preferred_mail_format];
+      }
 
       // get preferred languages
       if (!empty($contact->preferred_language)) {
index d59e025bb8ea0719b73a2bda61dcab46620ea04e..f4ee13293dad0b01c65f45c88fe2e4b58ab31249 100755 (executable)
@@ -107,7 +107,10 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase {
 
     $this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input");
     $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", $contributionAmount);
+    $this->typeKeys("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", $contributionAmount);
     $this->type("email-5", $email);
+    $this->click("xpath=//label[text()='Test Processor']");
+    $this->waitForAjaxContent();
 
     $this->webtestAddCreditCardDetails();
     $this->webtestAddBillingDetails($firstName, $middleName, $lastName);
@@ -161,7 +164,10 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase {
     $this->openCiviPage("contribute/transact", "reset=1&id=$pageId&pcpId=$id[1]", "_qf_Main_upload-bottom");
     $this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input");
     $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", $contributionAmount);
+    $this->typeKeys("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", $contributionAmount);
     $this->type("email-5", $donorFirstName . "@example.com");
+    $this->click("xpath=//label[text()='Test Processor']");
+    $this->waitForAjaxContent();
 
     $this->webtestAddCreditCardDetails();
     $this->webtestAddBillingDetails($donorFirstName, $middleName, $donorLastName);
@@ -178,8 +184,8 @@ class WebTest_Contribute_PCPAddTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('contribution_pcp_made_through_id');
     $this->multiselect2('contribution_pcp_made_through_id', array($pcpTitle));
 
-    $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1][text()='View']");
-    $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1][text()='View']");
+    $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]//td/span/a[1][text()='View']");
+    $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]//td/span/a[1][text()='View']");
     $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[3]/span[2]");
 
     // View Contribution Record and test for expected values
index 6c22d69308ce2c972c40f034fc621c354eb58cd6..4a7e09ea3fbdd622840b6fbe71c16bd1494e2edf 100644 (file)
@@ -444,8 +444,8 @@ 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/div[@class='crm-accordion-wrapper']/div/table/tbody/tr/td/span[text()='{$amount}']");
-    $this->assertTrue($this->isElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/div[@class='crm-accordion-wrapper']/div/table/tbody/tr/td/span[text()='{$amount}']"));
+    $this->waitForElementPresent("xpath=//form[@id='MembershipView']/div[2]/div/div[@class='crm-accordion-wrapper']/div[2]/table/tbody/tr/td/a");
+    $this->assertElementContainsText("xpath=//form[@id='MembershipView']/div[2]/div/div[@class='crm-accordion-wrapper']/div[2]/table/tbody/tr/td/a", $amount);
     $this->click("_qf_MembershipView_cancel-bottom");
   }
 
index 5f9878c3d5cd676b51696b33f323b06f0b1c54a9..cf0b6a73454aa78a0cc272edd7a4bceaf88a14b8 100644 (file)
@@ -134,11 +134,11 @@ class WebTest_Member_StandaloneAddTest extends CiviSeleniumTestCase {
     $this->select('payment_instrument_id', 'Check');
     $this->select('contribution_status_id', 'Completed');
 
-    $this->click("_qf_Membership_upload");
+    $this->clickLink("_qf_Membership_upload");
 
     //View Membership
     $this->waitForElementPresent("xpath=//table[@class='display dataTable no-footer']/tbody/tr[1]/td[9]/span/a[text()='View']");
-    $this->click("xpath=xpath=//table[@class='display dataTable no-footer']/tbody/tr[1]/td[9]/span/a[text()='View']");
+    $this->click("xpath=//table[@class='display dataTable no-footer']/tbody/tr[1]/td[9]/span/a[text()='View']");
     $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
 
     // verify soft credit data
index f734f948eaae58929f3ebd77777d2f7f961caa9c..9f32a391579680639a57c6b140d4cd1f25cca377 100644 (file)
@@ -209,7 +209,7 @@ class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTest
     $this->waitForPageToLoad($this->getTimeoutMsec());
   }
 
-  public function testAdedPledgePaymentWithAdjustTotalPledgeAmount() {
+  public function testAddPledgePaymentWithAdjustTotalPledgeAmount() {
     $this->webtestLogin();
     // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg
     $this->enableDisablePopups(FALSE);