3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Contact_TagAddTest
extends CiviSeleniumTestCase
{
31 protected function setUp() {
35 function testAddTag() {
36 $this->webtestLogin();
38 $this->openCiviPage("admin/tag", "action=add&reset=1", "_qf_Tag_next");
41 $tagName = 'tag_' . substr(sha1(rand()), 0, 7);
44 $this->type("name", $tagName);
47 $this->type("description", "Adding new tag.");
49 // select used for contact
50 $this->select("used_for", "value=civicrm_contact");
53 $this->click("is_reserved");
56 $this->click("_qf_Tag_next");
57 $this->waitForPageToLoad($this->getTimeoutMsec());
59 // Is status message correct?
60 $this->assertTrue($this->isTextPresent("The tag '$tagName' has been saved."));
63 $this->click("xpath=//table//tr/th[text()=\"ID\"]");
64 $this->waitForElementPresent("css=table.display tbody tr td");
67 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']");
68 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[2][text()='Adding new tag. ']");
69 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[4][text()= 'Contacts']");
70 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagName']/following-sibling::td[7]/span/a[text()= 'Edit']");
73 function testAddTagSet() {
74 $this->webtestLogin();
76 $this->openCiviPage("admin/tag", "action=add&reset=1&tagset=1");
79 $tagSetName = 'tagset_' . substr(sha1(rand()), 0, 7);
82 $this->type("name", $tagSetName);
85 $this->type("description", "Adding new tag set.");
87 // select used for contact
88 $this->select("used_for", "value=civicrm_contact");
91 $this->click("is_reserved");
94 $this->click("_qf_Tag_next");
95 $this->waitForPageToLoad($this->getTimeoutMsec());
97 // Is status message correct?
98 $this->assertTrue($this->isTextPresent("The tag '$tagSetName' has been saved."));
101 $this->click("xpath=//table//tr/th[text()=\"ID\"]");
102 $this->waitForElementPresent("css=table.display tbody tr td");
105 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']");
106 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[2][text()='Adding new tag set. ']");
107 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[4][text()= 'Contacts']");
108 $this->waitForElementPresent("xpath=//table//tbody/tr/td[1][text()= '$tagSetName']/following-sibling::td[7]/span/a[text()= 'Edit']");