Merge pull request #71 from dpradeep/merge-20140930
[civicrm-core.git] / tests / phpunit / WebTest / Contact / AdvanceSearchPaneTest.php
index 6faa45d5676b0ead3a532859f3870889a6205d32..964d20d1a346b03d8e2364cd468c72e6d7471f0b 100644 (file)
 */
 
 require_once 'CiviTest/CiviSeleniumTestCase.php';
+
+/**
+ * Class WebTest_Contact_AdvanceSearchPaneTest
+ */
 class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
 
   protected function setUp() {
@@ -82,6 +86,9 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
     $this->_checkOpenedPanes(array_keys($allpanes));
   }
 
+  /**
+   * @param array $openedPanes
+   */
   function _checkOpenedPanes($openedPanes = array(
     )) {
     if (!$this->isTextPresent('No matches found')) {
@@ -101,6 +108,10 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
     }
   }
 
+  /**
+   * @param $paneRef
+   * @param array $selectFields
+   */
   function _selectPaneFields($paneRef, $selectFields = array(
     )) {
     $pane = $this->_advanceSearchPanes($paneRef);
@@ -140,6 +151,13 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
           }
           break;
 
+        case 'multiselect2':
+          foreach ($field['values'] as $op) {
+            $this->waitForVisible($fldLocator);
+            $this->multiselect2($fldLocator, $op);
+          }
+          break;
+
         case 'date':
           $this->webtestFillDate($fldLocator, current($field['values']));
           break;
@@ -147,6 +165,11 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
     }
   }
 
+  /**
+   * @param null $paneRef
+   *
+   * @return array
+   */
   function _advanceSearchPanes($paneRef = NULL) {
     static $_advance_search_panes;
 
@@ -161,8 +184,9 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
           array(
             'Location Type' =>
             array(
-              'type' => 'checkbox',
-              'values' => array('location_type[1]', 'location_type[2]'),
+              'type' => 'multiselect2',
+              'locator' => 'location_type',
+              'values' => array(array('Home', 'Work')),
             ),
             'Country' =>
             array(
@@ -172,9 +196,9 @@ class WebTest_Contact_AdvanceSearchPaneTest extends CiviSeleniumTestCase {
             ),
             'State' =>
             array(
-              'type' => 'select',
+              'type' => 'multiselect2',
               'locator' => 'state_province',
-              'values' => array('Alabama', 'California', 'New Jersey', 'New York'),
+              'values' => array(array('Alabama', 'California', 'New Jersey', 'New York')),
             ),
           ),
         ),