Merge pull request #9560 from aydun/CRM-19754
[civicrm-core.git] / tests / phpunit / WebTest / Contact / PrivacyOptionSearchTest.php
index 104936dc08b53153d0b9f97c8b87731285069ecf..0bf267b2e655a22397f9011d7cea72977d304ba0 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -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');