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_PrevNextTest
extends CiviSeleniumTestCase
{
31 protected function setUp() {
35 function testPrevNext() {
36 // This is the path where our testing install resides.
37 // The rest of URL is defined in CiviSeleniumTestCase base class, in
39 $this->open($this->sboxPath
);
41 // Logging in. Remember to wait for page to load. In most cases,
42 // you can rely on 30000 as the value that allows your test to pass, however,
43 // sometimes your test might fail because of this. In such cases, it's better to pick one element
44 // somewhere at the end of page and use waitForElementPresent on it - this assures you, that whole
45 // page contents loaded and you can continue your test execution.
46 $this->webtestLogin();
51 $this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload');
53 $groupName = 'group_' . substr(sha1(rand()), 0, 7);
54 $this->type("title", $groupName);
57 $this->type("description", "Adding new group.");
59 // check Access Control
60 $this->click("group_type[1]");
63 $this->click("_qf_Edit_upload");
64 $this->waitForPageToLoad($this->getTimeoutMsec());
69 $contact1 = substr(sha1(rand()), 0, 7);
70 $this->webtestAddContact($contact1, "AAA", "{$contact1}@example.com");
72 // Add Individual 1 to group
73 $this->click('css=li#tab_group a');
74 $this->waitForElementPresent('_qf_GroupContact_next');
75 $this->select('group_id', "label={$groupName}");
76 $this->click('_qf_GroupContact_next');
77 $this->waitForPageToLoad($this->getTimeoutMsec());
78 $this->assertElementContainsText('crm-notification-container', "Added to Group");
81 $contact2 = substr(sha1(rand()), 0, 7);
82 $this->webtestAddContact($contact2, "BBB", "{$contact2}@example.com");
84 // Add Individual 2 to group
85 $this->click('css=li#tab_group a');
86 $this->waitForElementPresent('_qf_GroupContact_next');
87 $this->select('group_id', "label={$groupName}");
88 $this->click('_qf_GroupContact_next');
89 $this->waitForPageToLoad($this->getTimeoutMsec());
90 $this->assertElementContainsText('crm-notification-container', "Added to Group");
93 $contact3 = substr(sha1(rand()), 0, 7);
94 $this->webtestAddContact($contact3, "CCC", "{$contact3}@example.com");
96 // Add Individual 3 to group
97 $this->click('css=li#tab_group a');
98 $this->waitForElementPresent('_qf_GroupContact_next');
99 $this->select('group_id', "label={$groupName}");
100 $this->click('_qf_GroupContact_next');
101 $this->waitForPageToLoad($this->getTimeoutMsec());
102 $this->assertElementContainsText('crm-notification-container', "Added to Group");
105 $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh');
107 $this->select('group', "label={$groupName}");
108 $this->click("_qf_Basic_refresh");
109 $this->waitForPageToLoad(2 * $this->getTimeoutMsec());
110 $this->assertElementContainsText('search-status', "3 Contacts");
112 $this->click("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[3]/a");
113 $this->waitForPageToLoad($this->getTimeoutMsec());
115 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact1} AAA");
116 $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
118 $this->click("xpath=//ul[@id='actions']/li[@class='crm-next-action']/a");
119 $this->waitForPageToLoad($this->getTimeoutMsec());
120 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact2} BBB");
121 $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
122 $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
124 $this->click("xpath=//ul[@id='actions']/li[@class='crm-next-action']/a");
125 $this->waitForPageToLoad($this->getTimeoutMsec());
126 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact3} CCC");
127 $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
129 $this->click("xpath=//ul[@id='actions']/li[@class='crm-previous-action']/a");
130 $this->waitForPageToLoad($this->getTimeoutMsec());
131 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact2} BBB");
132 $this->assertElementContainsText('css=li.crm-next-action a span', "Next");
133 $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous");
135 $this->click("xpath=//ul[@id='actions']/li[@class='crm-previous-action']/a");
136 $this->waitForPageToLoad($this->getTimeoutMsec());
137 $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact1} AAA");
138 $this->assertElementContainsText('css=li.crm-next-action a span', "Next");