CRM-18454: webtest fixes
[civicrm-core.git] / tests / phpunit / WebTest / Contact / PrivacyOptionSearchTest.php
index 6c77e883c571adf41e5730c5d9c3355ae9101c84..428307734aa35f40dfe6b37980536e845347bbb5 100644 (file)
@@ -109,14 +109,10 @@ class WebTest_Contact_PrivacyOptionSearchTest extends CiviSeleniumTestCase {
     // Go to advance search, check for 'Exclude' option.
     $this->openCiviPage("contact/search/advanced", "reset=1");
 
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[2]/td[2]//select[1]", "label={$groupName}");
+    $this->select("group", "label={$groupName}");
     $this->waitForTextPresent($groupName);
 
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[5]/td[1]/table[1]/tbody/tr[2]/td[1]//select[1]", 'value=do_not_phone');
-    $this->waitForTextPresent('Do not phone');
-
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[5]/td[1]/table[1]/tbody/tr[2]/td[1]//select[1]", 'value=do_not_email');
-    $this->waitForTextPresent('Do not email');
+    $this->multiselect2('privacy_options', array('Do not phone', 'Do not email'));
 
     $this->click("_qf_Advanced_refresh");
     $this->waitForPageToLoad(2 * $this->getTimeoutMsec());
@@ -126,16 +122,12 @@ class WebTest_Contact_PrivacyOptionSearchTest extends CiviSeleniumTestCase {
     // Go to advance search, check for 'Include' + 'OR' options.
     $this->openCiviPage("contact/search/advanced", "reset=1");
 
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[2]/td[2]//select[1]", "label={$groupName}");
+    $this->select("group", "label={$groupName}");
     $this->waitForTextPresent($groupName);
 
-    $this->click("xpath=//form[@id='Advanced']//table[1]/tbody/tr[5]/td[1]/table[1]/tbody/tr[1]/td[1]//input[2]");
-
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[5]/td[1]/table[1]/tbody/tr[2]/td[1]//select[1]", 'value=do_not_phone');
-    $this->waitForTextPresent('Do not phone');
+    $this->click("CIVICRM_QFID_2_privacy_toggle");
 
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[5]/td[1]/table[1]/tbody/tr[2]/td[1]//select[1]", 'value=do_not_email');
-    $this->waitForTextPresent('Do not email');
+    $this->multiselect2('privacy_options', array('Do not phone', 'Do not email'));
 
     $this->click("_qf_Advanced_refresh");
     $this->waitForPageToLoad(2 * $this->getTimeoutMsec());
@@ -146,16 +138,12 @@ class WebTest_Contact_PrivacyOptionSearchTest extends CiviSeleniumTestCase {
     // Go to advance search, check for 'Include' + 'AND' options.
     $this->openCiviPage("contact/search/advanced", "reset=1");
 
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[2]/td[2]//select[1]", "label={$groupName}");
+    $this->select("group", "label={$groupName}");
     $this->waitForTextPresent($groupName);
 
-    $this->click("xpath=//form[@id='Advanced']//table[1]/tbody/tr[5]/td[1]/table[1]/tbody/tr[1]/td[1]//input[2]");
-
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[5]/td[1]/table[1]/tbody/tr[2]/td[1]//select[1]", 'value=do_not_phone');
-    $this->waitForTextPresent('Do not phone');
+    $this->click("CIVICRM_QFID_2_privacy_toggle");
 
-    $this->select("xpath=//form[@id='Advanced']//table[1]/tbody/tr[5]/td[1]/table[1]/tbody/tr[2]/td[1]//select[1]", 'value=do_not_trade');
-    $this->waitForTextPresent('Do not trade');
+    $this->multiselect2('privacy_options', array('Do not phone', 'Do not trade'));
 
     $this->select('privacy_operator', 'value=AND');