3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Contact_TagAddTest
32 class WebTest_Contact_TagAddTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 public function testAddTag() {
39 $this->webtestLogin();
41 $this->openCiviPage("admin/tag", "action=add&reset=1", "_qf_Tag_next");
44 $tagName = 'tag_' . substr(sha1(rand()), 0, 7);
47 $this->type("name", $tagName);
50 $this->type("description", "Adding new tag.");
52 // select used for contact
53 $this->select("used_for", "value=civicrm_contact");
56 $this->click("is_reserved");
59 $this->click("_qf_Tag_next");
60 $this->waitForPageToLoad($this->getTimeoutMsec());
62 // Is status message correct?
63 $this->assertTrue($this->isTextPresent("The tag '$tagName' has been saved."));
66 $this->click("xpath=//table//tr/th[text()=\"ID\"]");
67 $this->waitForElementPresent("css=table.display tbody tr td");
70 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']");
71 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[2][text()='Adding new tag. ']");
72 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[4][text()= 'Contacts']");
73 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[7]/span/a[text()= 'Edit']");
76 public function testAddTagSet() {
77 $this->webtestLogin();
79 $this->openCiviPage("admin/tag", "action=add&reset=1&tagset=1");
82 $tagSetName = 'tagset_' . substr(sha1(rand()), 0, 7);
85 $this->type("name", $tagSetName);
88 $this->type("description", "Adding new tag set.");
90 // select used for contact
91 $this->select("used_for", "value=civicrm_contact");
94 $this->click("is_reserved");
97 $this->click("_qf_Tag_next");
98 $this->waitForPageToLoad($this->getTimeoutMsec());
100 // Is status message correct?
101 $this->assertTrue($this->isTextPresent("The tag '$tagSetName' has been saved."));
104 $this->click("xpath=//table//tr/th[text()=\"ID\"]");
105 $this->waitForElementPresent("css=table.display tbody tr td");
108 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']");
109 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[2][text()='Adding new tag set. ']");
110 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[4][text()= 'Contacts']");
111 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[7]/span/a[text()= 'Edit']");