X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FWebTest%2FContact%2FGroupAddTest.php;h=24eb83f78988591184d2cf284a41cadc979d9075;hb=b48045a740f9b4b47c9f320616baf8ea1f3e2c04;hp=8a127f90842450192cad0a1d5e967fe84d82576c;hpb=1a1405c224536663052966d274c3555b24ce490a;p=civicrm-core.git diff --git a/tests/phpunit/WebTest/Contact/GroupAddTest.php b/tests/phpunit/WebTest/Contact/GroupAddTest.php index 8a127f9084..24eb83f789 100644 --- a/tests/phpunit/WebTest/Contact/GroupAddTest.php +++ b/tests/phpunit/WebTest/Contact/GroupAddTest.php @@ -1,9 +1,9 @@ assertTrue($this->isElementPresent("xpath=//table/tbody//tr/td[3]/a[text()='{$lastName}, {$firstName}']")); } + /** + * CRM-18585 - test to check OR operator on Smart Groups + */ + public function testAddSmartGroup() { + $this->webtestLogin(); + $this->openCiviPage('contact/search/advanced', 'reset=1'); + $this->click("xpath=//input[@value='OR']"); + $this->select('group', 'Advisory Board'); + $this->select('contact_tags', 'Major Donor'); + $this->clickLink("_qf_Advanced_refresh"); + $this->waitForElementPresent("task"); + $count = trim($this->getText("//div[@id='search-status']/table/tbody/tr/td")); + + //create smart group for contacts resulted from OR operator search. + $this->click('radio_ts', 'ts_all'); + $this->click('task'); + $this->select('task', 'label=Group - create smart group'); + $this->waitForPageToLoad($this->getTimeoutMsec()); + $smartGroupTitle = "SmartGroup" . substr(sha1(rand()), 0, 4); + $this->type("title", $smartGroupTitle); + $this->clickLink("_qf_SaveSearch_next-bottom"); + $this->waitForText('crm-notification-container', "Your smart group has been saved as '$smartGroupTitle'"); + $this->clickLink("_qf_Result_done"); + $expectedCount = explode('-', $this->getText("//div[@id='search-status']/table/tbody/tr/td")); + $this->assertEquals($count, trim($expectedCount[1])); + + //Assert the count from Contacts link in Manage Group Page. + $this->openCiviPage('group', 'reset=1'); + $this->waitForElementPresent("xpath=//table/tbody//tr//td/div[contains(text(), \"{$smartGroupTitle} (Smart Group)\")]"); + $this->clickLink("xpath=//table/tbody//tr//td/div[contains(text(), \"{$smartGroupTitle} (Smart Group)\")]/../../td[@class='crm-group-group_links']/span/a[contains(text(), 'Contacts')]"); + $this->waitForElementPresent("xpath=//span[contains(text(), \"Edit Smart Group Search Criteria for {$smartGroupTitle}\")]"); + $this->clickLink("xpath=//a/span[contains(text(), \"Edit Smart Group Search Criteria for {$smartGroupTitle}\")]/"); + $this->waitForElementPresent('search-status'); + $expectedCount = explode('-', $this->getText("//div[@id='search-status']/table/tbody/tr/td")); + $this->assertEquals($count, trim($expectedCount[1])); + } + }