Merge pull request #4664 from aydun/CRM-15681-master
[civicrm-core.git] / tests / phpunit / WebTest / Contact / AdvancedSearchTest.php
index b8493d34723665328daf17e0c508e85cdbb01718..083bbe5de626b2fded129cf1e678f3f4ac0323c1 100644 (file)
@@ -58,16 +58,16 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase {
     // go to group tab and add to new group
     $this->clickAjaxLink("css=li#tab_group a", "_qf_GroupContact_next");
     $this->select("group_id", "$groupName");
-    $this->clickAjaxLink("_qf_GroupContact_next", NULL);
+    $this->clickAjaxLink("_qf_GroupContact_next");
     $this->waitForText('crm-notification-container', "Contact has been added to '$groupName'");
 
     // go to tag tab and add to new tag
     $this->clickAjaxLink("css=li#tab_tag a", "css=div#tagtree");
     $this->click("xpath=//ul/li/span/label[text()=\"$tagName\"]");
-    $this->waitForStatusMsg();
+    $this->checkCRMStatus();
 
     // register for event ( auto add activity and contribution )
-    $this->clickAjaxLink("link=Register for Event");
+    $this->clickPopupLink("link=Register for Event");
     $this->waitForText('s2id_event_id', "- select event -");
     $this->select2("event_id", "Fall Fundraiser Dinner");
     $this->waitForElementPresent("receipt_text");
@@ -83,7 +83,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase {
     $this->waitForText('crm-notification-container', "Event registration for $firstName adv$firstName has been added");
 
     // Add pledge
-    $this->clickAjaxLink("link=Add Pledge");
+    $this->clickPopupLink("link=Add Pledge");
     $this->waitForElementPresent("contribution_page_id");
     $this->type("amount", "200");
     $this->type("installments", "5");
@@ -93,7 +93,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase {
     $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
 
     // Add membership
-    $this->clickAjaxLink("link=Add Membership", "_qf_Membership_cancel-bottom");
+    $this->clickPopupLink("link=Add Membership", "_qf_Membership_cancel-bottom");
     //let the organisation be default (Default Organization)
     $this->select("membership_type_id[0]", "value=1");
     $this->click("membership_type_id[1]");
@@ -103,7 +103,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase {
     $this->waitForText('crm-notification-container', "Student membership for $firstName adv$firstName has been added");
 
     // Add relationship
-    $this->clickAjaxLink("link=Add Relationship", "_qf_Relationship_cancel");
+    $this->clickPopupLink("link=Add Relationship", "_qf_Relationship_cancel");
     $this->select2("relationship_type_id", "Employee of");
     $this->waitForElementPresent("xpath=//input[@id='related_contact_id'][@placeholder='- select organization -']");
     $this->select2("related_contact_id", "Default", TRUE);
@@ -212,7 +212,7 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase {
 
   //function to check match for sumbit Advance Search
   /**
-   * @param $firstName
+   * @param string $firstName
    */
   function submitSearch($firstName) {
     $this->clickLink("_qf_Advanced_refresh");
@@ -231,27 +231,13 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase {
     $this->webtestLogin();
     $this->openCiviPage('contact/search/advanced', 'reset=1', 'group');
     $this->select2("group", "Newsletter", TRUE);
+    $this->select2("group", "Summer", TRUE);
     $this->select2("group", "Advisory", TRUE);
     $this->clickAjaxLink("location", 'country');
     $this->select2("country", "United States", False);
-    $this->clickLink("_qf_Advanced_refresh");
-
-    $stateBeforeSort = $this->getText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]");
-    $this->click("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]");
-    $this->waitForElementPresent("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]");
-    $this->assertElementNotContainsText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]", $stateBeforeSort);
-    $this->clickAjaxLink("xpath=//form[@id='Advanced']//div//div[contains(text(),'Edit Search Criteria')]/../div", 'group');
-    $this->select2("group", "Summer", TRUE);
     $this->waitForElementPresent('state_province');
-    $this->select2("state_province", "Ohio", TRUE);
-    $this->select2("state_province", "New York", TRUE);
-    $this->select2("state_province", "New Mexico", TRUE);
-    $this->select2("state_province", "Mississippi", TRUE);
-    $this->select2("state_province", "Connecticut", TRUE);
-    $this->select2("state_province", "Georgia", TRUE);
-    $this->select2("state_province", "New Jersey", TRUE);
-    $this->select2("state_province", "Texas", TRUE);
-    $this->clickLink("_qf_Advanced_refresh");
+    $this->multiselect2("state_province", array("Ohio", "New York", "New Mexico", "Connecticut", "Georgia", "New Jersey", "Texas"));
+    $this->clickLink("_qf_Advanced_refresh", "xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]");
 
     $stateBeforeSort = $this->getText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]");
     $this->click("xpath=//div[@class='crm-search-results']//table/thead/tr//th/a[contains(text(),'State')]");
@@ -261,8 +247,8 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase {
 
   // function to fill basic search detail
   /**
-   * @param $firstName
-   * @param $groupName
+   * @param string $firstName
+   * @param string $groupName
    * @param $tagName
    */
   function addBasicSearchDetail($firstName, $groupName, $tagName) {