From cd223eef8d28a57f0cb8809a9a039f2169ce1ad2 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Thu, 10 Dec 2015 18:46:11 +0530 Subject: [PATCH] webtest fixes --- CRM/Contact/BAO/Contact.php | 6 ++++-- tests/phpunit/WebTest/Contribute/PCPAddTest.php | 10 ++++++++-- .../Member/OfflineMembershipAddPricesetTest.php | 4 ++-- tests/phpunit/WebTest/Member/StandaloneAddTest.php | 4 ++-- .../Pledge/ContactContextPledgePaymentAddTest.php | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 13c69e603d..b70957827d 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -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)) { diff --git a/tests/phpunit/WebTest/Contribute/PCPAddTest.php b/tests/phpunit/WebTest/Contribute/PCPAddTest.php index d59e025bb8..f4ee13293d 100755 --- a/tests/phpunit/WebTest/Contribute/PCPAddTest.php +++ b/tests/phpunit/WebTest/Contribute/PCPAddTest.php @@ -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 diff --git a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php index 6c22d69308..4a7e09ea3f 100644 --- a/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php +++ b/tests/phpunit/WebTest/Member/OfflineMembershipAddPricesetTest.php @@ -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"); } diff --git a/tests/phpunit/WebTest/Member/StandaloneAddTest.php b/tests/phpunit/WebTest/Member/StandaloneAddTest.php index 5f9878c3d5..cf0b6a7345 100644 --- a/tests/phpunit/WebTest/Member/StandaloneAddTest.php +++ b/tests/phpunit/WebTest/Member/StandaloneAddTest.php @@ -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 diff --git a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php index f734f948ea..9f32a39157 100644 --- a/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php +++ b/tests/phpunit/WebTest/Pledge/ContactContextPledgePaymentAddTest.php @@ -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); -- 2.25.1