Webtests Fixes
[civicrm-core.git] / tests / phpunit / WebTest / Contact / MergeContactsTest.php
index 417c986962067b1ea6c5f07ce16fa1a34a8afac8..d86f7b72418e0c1906b5ff45d71b3d35f91b2fd2 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -382,11 +382,12 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
 
     // Select the contacts to be merged
     $this->waitForElementPresent('dupePairs_length');
-    $this->select("name=dupePairs_length", "value=100");
     $this->waitForElementPresent("xpath=//a[text()='$firstName $lastName']");
-    $this->click("xpath=//a[text()='$firstName $lastName']/../../td[4]/a[text()='merge']");
+    $this->click("xpath=//a[text()='$firstName $lastName']/../../td[8]/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)']", FALSE);
+    $this->clickLink("css=div.crm-contact-merge-form-block div.action-link a");
+
+    $this->waitForElementPresent("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[5]/td[4]/span[text()='(add)']");
     $this->waitForElementPresent('_qf_Merge_cancel-bottom');
 
@@ -472,9 +473,8 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
 
     // Select the contacts to be merged
     $this->waitForElementPresent('dupePairs_length');
-    $this->select("name=dupePairs_length", "value=100");
-    $this->waitForElementPresent("xpath=//table[@class='pagerDisplay dataTable no-footer']/tbody//tr/td[1]/a[text()='$firstName1 $lastName1']/../../td[2]/a[text()='$firstName1 $lastName1']");
-    $this->click("xpath=//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("xpath=//a[text()='$firstName1 $lastName1']");
+    $this->click("xpath=//a[text()='$firstName1 $lastName1']/../../td[8]/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[4]/td[4]/span[text()='(overwrite)']");
     $this->waitForElementPresent("xpath=//form[@id='Merge']/div[2]/table/tbody/tr[3]/td[4]/span[text()='(add)']");
@@ -827,6 +827,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
 
     // add relationship "Employer of"
     // click through to the relationship view screen
+    $this->waitForAjaxContent();
     $this->click("css=li#tab_rel a");
 
     // wait for add Relationship link
@@ -838,6 +839,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->select('relationship_type_id', "value=5_b_a");
 
     //fill in the individual
+    $this->waitForElementPresent('related_contact_id');
     $this->select2('related_contact_id', $sortName, TRUE, FALSE);
 
     $this->waitForElementPresent("_qf_Relationship_upload");
@@ -855,11 +857,10 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
 
     //check the status message
     $this->waitForText('crm-notification-container', "Relationship created.");
-
     $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[9]/span/a[text()='View']");
-    $this->waitForElementPresent("xpath=//a[text()='$sortName']");
+    $this->waitForAjaxContent();
     $this->click("xpath=//a[text()='$sortName']");
-    $this->waitForPageToLoad($this->getTimeoutMsec());
+    $this->waitForAjaxContent();
 
     // Check if Membership for the individual is created
     $this->waitForElementPresent("xpath=//li[@id='tab_member']/a/em");
@@ -875,6 +876,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
 
     // add relationship "Employer of"
     // click through to the relationship view screen
+    $this->waitForAjaxContent();
     $this->click("css=li#tab_rel a");
 
     // wait for add Relationship link
@@ -886,6 +888,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->select('relationship_type_id', "value=5_b_a");
 
     //fill in the individual
+    $this->waitForElementPresent('related_contact_id');
     $this->select2('related_contact_id', $sortNameOther, TRUE, FALSE);
 
     $this->waitForElementPresent("_qf_Relationship_upload");
@@ -915,13 +918,14 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // click through to the relationship view screen
+    $this->waitForAjaxContent();
     $this->click("css=li#tab_rel a");
 
     // wait for add Relationship link
-    $this->waitForElementPresent("xpath=//a[text()='$sortName']");
+    $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr//td//a[text()='$sortName']");
     // go to duplicate organization's related contact
     // to check if membership is added to that contact
-    $this->click("xpath=//a[text()='$sortName']");
+    $this->click("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr//td//a[text()='$sortName']");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Check if Membership for the individual is created