*/
function select2($fieldName,$label, $multiple = FALSE, $xpath=FALSE) {
if ($multiple) {
- $this->clickAt("//*[@id='$fieldName']/../div/ul/li[1]");
- $this->keyDown("//*[@id='$fieldName']/../div/ul/li[1]/input", " ");
- $this->type("//*[@id='$fieldName']/../div/ul/li[1]/input", $label);
- $this->typeKeys("//*[@id='$fieldName']/../div/ul/li[1]/input", $label);
+ $this->clickAt("//*[@id='$fieldName']/../div/ul/li");
+ $this->keyDown("//*[@id='$fieldName']/../div/ul/li//input", " ");
+ $this->type("//*[@id='$fieldName']/../div/ul/li//input", $label);
+ $this->typeKeys("//*[@id='$fieldName']/../div/ul/li//input", $label);
$this->waitForElementPresent("//*[@class='select2-result-label']");
$this->clickAt("//*[@class='select2-results']/li[1]/div");
}
);
}
+ /*
+ * Check for CRM-14952
+ */
+ function testStateSorting() {
+ $this->webtestLogin();
+ $this->openCiviPage('contact/search/advanced', 'reset=1');
+ $this->waitForElementPresent('group');
+ $this->select2("group", "Newsletter", TRUE);
+ $this->select2("group", "Advisory", TRUE);
+ $this->click("location");
+ $this->waitForElementPresent('country');
+ $this->select2("country", "United States", False);
+ $this->click("_qf_Advanced_refresh");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+ $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->waitForPageToLoad($this->getTimeoutMsec());
+ $this->assertElementNotContainsText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]", $stateBeforeSort);
+ $this->click("xpath=//form[@id='Advanced']//div//div[contains(text(),'Edit Search Criteria')]/../div");
+ $this->waitForElementPresent('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->click("_qf_Advanced_refresh");
+ $this->waitForPageToLoad($this->getTimeoutMsec());
+ $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->waitForPageToLoad($this->getTimeoutMsec());
+ $this->assertElementNotContainsText("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[6]", $stateBeforeSort);
+ }
+
// function to fill basic search detail
/**
* @param $firstName