From: atif-shaikh Date: Thu, 24 Jul 2014 13:07:46 +0000 (+0530) Subject: Webtest for CRM-14952 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=48ebbfbe87e83822728ce5cdd3a3ce8173b413c2;p=civicrm-core.git Webtest for CRM-14952 ---------------------------------------- * CRM-14952: Sorting on state in search throws FATAL error: Database Error Code: Unknown column 'civicrm_state_province.name' in 'field list' https://issues.civicrm.org/jira/browse/CRM-14952 --- diff --git a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php index 1c1a6cd2d6..f5a68ad68f 100644 --- a/tests/phpunit/CiviTest/CiviSeleniumTestCase.php +++ b/tests/phpunit/CiviTest/CiviSeleniumTestCase.php @@ -2095,10 +2095,10 @@ class CiviSeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase { */ 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"); } diff --git a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php index cf59ce2ab4..3a1bb9339f 100644 --- a/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php +++ b/tests/phpunit/WebTest/Contact/AdvancedSearchTest.php @@ -260,6 +260,44 @@ class WebTest_Contact_AdvancedSearchTest extends CiviSeleniumTestCase { ); } + /* + * 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