3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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';
28 class WebTest_Contact_TagAddTest
extends CiviSeleniumTestCase
{
30 protected function setUp() {
34 function testAddTag() {
35 $this->webtestLogin();
37 $this->openCiviPage("admin/tag", "action=add&reset=1", "_qf_Tag_next");
40 $tagName = 'tag_' . substr(sha1(rand()), 0, 7);
43 $this->type("name", $tagName);
46 $this->type("description", "Adding new tag.");
48 // select used for contact
49 $this->select("used_for", "value=civicrm_contact");
52 $this->click("is_reserved");
55 $this->click("_qf_Tag_next");
56 $this->waitForPageToLoad($this->getTimeoutMsec());
58 // Is status message correct?
59 $this->assertTrue($this->isTextPresent("The tag '$tagName' has been saved."));
62 $this->click("xpath=//table//tr/th[text()=\"ID\"]");
63 $this->waitForElementPresent("css=table.display tbody tr td");
66 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']");
67 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[2][text()='Adding new tag. ']");
68 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[4][text()= 'Contacts']");
69 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[7]/span/a[text()= 'Edit']");
72 function testAddTagSet() {
73 $this->webtestLogin();
75 $this->openCiviPage("admin/tag", "action=add&reset=1&tagset=1");
78 $tagSetName = 'tagset_' . substr(sha1(rand()), 0, 7);
81 $this->type("name", $tagSetName);
84 $this->type("description", "Adding new tag set.");
86 // select used for contact
87 $this->select("used_for", "value=civicrm_contact");
90 $this->click("is_reserved");
93 $this->click("_qf_Tag_next");
94 $this->waitForPageToLoad($this->getTimeoutMsec());
96 // Is status message correct?
97 $this->assertTrue($this->isTextPresent("The tag '$tagSetName' has been saved."));
100 $this->click("xpath=//table//tr/th[text()=\"ID\"]");
101 $this->waitForElementPresent("css=table.display tbody tr td");
104 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']");
105 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[2][text()='Adding new tag set. ']");
106 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[4][text()= 'Contacts']");
107 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[7]/span/a[text()= 'Edit']");