From 34b568c4f00791aa48c724b9c1e7bba247e80930 Mon Sep 17 00:00:00 2001 From: Rohan Katkar Date: Mon, 5 Jan 2015 11:34:28 +0530 Subject: [PATCH] Webtests and CRM test fix --- CRM/Batch/Form/Entry.php | 2 +- .../WebTest/Contact/MergeContactsTest.php | 2 +- .../WebTest/Event/MultiprofileEventTest.php | 32 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 8c8df3381c..a6833db5cf 100755 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -507,7 +507,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { //finally call contribution create for all the magic $contribution = CRM_Contribute_BAO_Contribution::create($value, CRM_Core_DAO::$_nullArray); $batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id', array('flip' => 1), 'validate'); - if ($this->_batchInfo['type_id'] == $batchTypes['Pledge Payment']) { + if (!empty($this->_batchInfo['type_id']) && ($this->_batchInfo['type_id'] == $batchTypes['Pledge Payment'])) { $adjustTotalAmount = FALSE; if (isset($params['option_type'][$key])) { if ($params['option_type'][$key] == 2) { diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index 439b401984..8b32daa619 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -240,7 +240,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForElementPresent('_qf_DedupeFind_submit-bottom'); $this->click("_qf_DedupeFind_next-bottom"); - $this->waitForElementPresent("xpath=//table[@id='option51']/tbody/tr[1]/td[4]/a[text()='merge']"); + $this->waitForElementPresent("xpath=div[@id='DedupeFind']/div[2]/div/table/tbody/tr[1]/td[4]/a[text()='merge']"); $this->waitForElementPresent("xpath=//*[@id='DedupeFind']/a[3]/span[contains(text(),'Done')]"); $this->isElementPresent("xpath=//table[@id='option51']/tbody/tr/td[1]/a[text()='{$firstName} {$lastName}']/../td[2]/a[text()='{$fName} {$lName}']"); $this->click("xpath=//table[@id='option51']/tbody/tr[1]/td[4]/a[text()='merge']"); diff --git a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php index d750dcd87c..7acfd73754 100644 --- a/tests/phpunit/WebTest/Event/MultiprofileEventTest.php +++ b/tests/phpunit/WebTest/Event/MultiprofileEventTest.php @@ -324,10 +324,10 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { // Go to Online Contribution tab $this->click("link=Online Registration"); $this->waitForElementPresent("_qf_Registration_upload-bottom"); - $this->click("xpath=//*[@id='additional_custom_post_id_multiple_1']/parent::td/span/a[text()='remove profile']"); - $this->click("xpath=//*[@id='additional_custom_post_id_multiple_2']/parent::td/span/a[text()='remove profile']"); - $this->click("xpath=//*[@id='additional_custom_post_id_multiple_3']/parent::td/span/a[text()='remove profile']"); - $this->click("xpath=//*[@id='additional_custom_post_id_multiple_4']/parent::td/span/a[text()='remove profile']"); + $this->click("xpath=//*[@id='additional_custom_post_id_multiple_1']/parent::td/span[1]/a"); + $this->click("xpath=//*[@id='additional_custom_post_id_multiple_2']/parent::td/span[1]/a"); + $this->click("xpath=//*[@id='additional_custom_post_id_multiple_3']/parent::td/span[1]/a"); + $this->click("xpath=//*[@id='additional_custom_post_id_multiple_4']/parent::td/span[1]/a"); $this->click("_qf_Registration_upload-bottom"); $this->waitForElementPresent("_qf_Registration_upload-bottom"); } @@ -565,54 +565,54 @@ class WebTest_Event_MultiprofileEventTest extends CiviSeleniumTestCase { $this->waitForElementPresent("_qf_Registration_upload-bottom"); $this->click("is_online_registration"); $this->check("is_multiple_registrations"); - $this->select("xpath=//*[@id='custom_pre_id']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=1"); - $this->select("xpath=//*[@id='custom_post_id']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[3]); - $this->select("xpath=//*[@id='additional_custom_post_id']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "- same as for main contact -"); + $this->select("xpath=//*[@id='custom_pre_id']/parent::td/div[1]/div/span/select", "value=1"); + $this->select("xpath=//*[@id='custom_post_id']/parent::td/div[1]/div/span/select", "value=" . $profileId[3]); + $this->select("xpath=//*[@id='additional_custom_post_id']/parent::td/div[1]/div/span/select", "- same as for main contact -"); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("custom_post_id_multiple_1"); - $this->select("xpath=//*[@id='custom_post_id_multiple_1']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[2]); + $this->select("xpath=//*[@id='custom_post_id_multiple_1']/parent::td/div[1]/div/span/select", "value=" . $profileId[2]); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("custom_post_id_multiple_2"); - $this->select("xpath=//*[@id='custom_post_id_multiple_2']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[1]); + $this->select("xpath=//*[@id='custom_post_id_multiple_2']/parent::td/div[1]/div/span/select", "value=" . $profileId[1]); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("custom_post_id_multiple_3"); - $this->select("xpath=//*[@id='custom_post_id_multiple_3']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[4]); + $this->select("xpath=//*[@id='custom_post_id_multiple_3']/parent::td/div[1]/div/span/select", "value=" . $profileId[4]); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("custom_post_id_multiple_4"); - $this->select("xpath=//*[@id='custom_post_id_multiple_4']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[5]); + $this->select("xpath=//*[@id='custom_post_id_multiple_4']/parent::td/div[1]/div/span/select", "value=" . $profileId[5]); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[2]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("custom_post_id_multiple_5"); - $this->select("xpath=//*[@id='custom_post_id_multiple_5']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[6]); + $this->select("xpath=//*[@id='custom_post_id_multiple_5']/parent::td/div[1]/div/span/select", "value=" . $profileId[6]); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("additional_custom_post_id_multiple_1"); - $this->select("xpath=//*[@id='additional_custom_post_id_multiple_1']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[5]); + $this->select("xpath=//*[@id='additional_custom_post_id_multiple_1']/parent::td/div[1]/div/span/select", "value=" . $profileId[5]); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("additional_custom_post_id_multiple_2"); - $this->select("xpath=//*[@id='additional_custom_post_id_multiple_2']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[1]); + $this->select("xpath=//*[@id='additional_custom_post_id_multiple_2']/parent::td/div[1]/div/span/select", "value=" . $profileId[1]); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("additional_custom_post_id_multiple_3"); - $this->select("xpath=//*[@id='additional_custom_post_id_multiple_3']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[2]); + $this->select("xpath=//*[@id='additional_custom_post_id_multiple_3']/parent::td/div[1]/div/span/select", "value=" . $profileId[2]); $this->waitForElementPresent("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->click("xpath=//div[@id='registration_screen']/table[3]//tbody/tr[2]/td[2]/span/a[text()='add another profile (bottom of page)']"); $this->waitForElementPresent("additional_custom_post_id_multiple_4"); - $this->select("xpath=//*[@id='additional_custom_post_id_multiple_4']/parent::td/div[1]/div/span/select[@class='select2-offscreen']", "value=" . $profileId[3]); + $this->select("xpath=//*[@id='additional_custom_post_id_multiple_4']/parent::td/div[1]/div/span/select", "value=" . $profileId[3]); $this->click("CIVICRM_QFID_1_is_email_confirm"); $this->type("confirm_from_name", "TestEvent"); -- 2.25.1