From e932244628fb30bbeef0a7ccb6d2824802ecb573 Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Wed, 14 May 2014 19:38:47 +0530 Subject: [PATCH] WebTestFix --- .../phpunit/CiviTest/CiviSeleniumTestCase.php | 2 +- .../WebTest/Contact/MergeContactsTest.php | 19 ++++++++++--------- .../WebTest/Event/AddParticipationTest.php | 10 ++++------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 1a4c13c793..12213c7867 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -1916,7 +1916,7 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { $this->type("//*[@id='select2-drop']/div/input", $label); $this->typeKeys("//*[@id='select2-drop']/div/input", $label); $this->waitForElementPresent("//*[@class='select2-result-label']"); - $this->clickAt("//*[contains(@class,'select2-result-selectable ')]/div[contains(@class, 'select2-result-label')]"); + $this->clickAt("//*[contains(@class,'select2-result-selectable')]/div[contains(@class, 'select2-result-label')]"); } } diff --git a/tests/phpunit/WebTest/Contact/MergeContactsTest.php b/tests/phpunit/WebTest/Contact/MergeContactsTest.php index ecd24f2a63..28de7db35c 100644 --- a/tests/phpunit/WebTest/Contact/MergeContactsTest.php +++ b/tests/phpunit/WebTest/Contact/MergeContactsTest.php @@ -183,8 +183,9 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Verify group merged $this->click("css=li#tab_group a"); - $this->waitForElementPresent("xpath=//form[@id='GroupContact']//div[@class='view-content']//div[@class='dataTables_wrapper']/table/tbody/tr"); - $this->verifyText("xpath=//form[@id='GroupContact']//div[@class='view-content']//div[@class='dataTables_wrapper']/table/tbody/tr/td/a", + $this->waitForElementPresent("GroupContact"); + $this->waitForElementPresent("xpath=//form[@id='GroupContact']//div[@class='view-content view-contact-groups']//div/table/tbody/tr/td/a"); + $this->verifyText("xpath=//form[@id='GroupContact']//div[@class='view-content view-contact-groups']//div/table/tbody/tr/td/a", preg_quote("$group") ); @@ -323,8 +324,8 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']"); $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); - $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(overwrite)']"); - $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(add)']"); + $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(overwrite)']", FALSE); + $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[5]/td[4]/span[text()='(add)']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); $this->check("move_location_email_1"); @@ -409,12 +410,12 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase { // Select the contacts to be merged $this->select("name=option51_length", "value=100"); - $this->waitForElementPresent("xpath=//table[@class='pagerDisplay']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']"); - $this->click("xpath=//table[@class='pagerDisplay']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']/../../td[4]/a[text()='merge']"); + $this->waitForElementPresent("xpath=//*[@id='DedupeFind']//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='57e10a6 9a3de85']/../../td[2]/a[text()='57e10a6 9a3de85']"); + $this->click("xpath=//*[@id='DedupeFind']//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']/../../td[4]/a[text()='merge']"); $this->waitForElementPresent('_qf_Merge_cancel-bottom'); - $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(overwrite)']"); - $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(add)']"); - $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[5]/td[4]/span[text()='(overwrite)']"); + $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a", "xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(overwrite)']"); + $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']"); + $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[4]/td[4]/span[text()='(overwrite)']"); $this->select('location_email_1_locTypeId', 'value=3'); $this->select('location_phone_1_locTypeId', 'value=1'); $this->assertFalse($this->isElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[2]/td[4]/span[text()='(overwrite)']")); diff --git a/tests/phpunit/WebTest/Event/AddParticipationTest.php b/tests/phpunit/WebTest/Event/AddParticipationTest.php index f9a696218d..f775009bbd 100644 --- a/tests/phpunit/WebTest/Event/AddParticipationTest.php +++ b/tests/phpunit/WebTest/Event/AddParticipationTest.php @@ -351,10 +351,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->openCiviPage("event/search", "reset=1"); $this->type('sort_name', $firstName); $eventName = "Rain-forest Cup Youth Soccer Tournament"; - $this->type("event_name", $eventName); - $this->click("event_name"); - $this->waitForElementPresent("css=div.ac_results-inner li"); - $this->click("css=div.ac_results-inner li"); + $this->select2("event_id", $eventName, FALSE, FALSE); $this->check('participant_test'); $this->click("_qf_Search_refresh"); $this->waitForElementPresent("participantSearch"); @@ -422,8 +419,9 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase { $this->webtestNewDialogContact($firstName, $lastName); $this->select('payment_processor_id', "value={$processorId}"); - $this->verifySelectedValue("event_id", "3"); - $this->check("role_id[1]"); + $event_id = $this->getAttribute("xpath=//*[@id='event_id']@value"); + $this->assertEquals($event_id, 3); + $this->select("role_id", "value=1"); $this->webtestAddCreditCardDetails(); $this->webtestAddBillingDetails(); } -- 2.25.1