Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06a1bc01 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
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. | | |
13 | | | | |
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. | | |
18 | | | | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 25 | */ |
6a488035 | 26 | |
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Contact_PrevNextTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Contact_PrevNextTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testPrevNext() { |
6a488035 TO |
39 | $this->webtestLogin(); |
40 | ||
6a488035 TO |
41 | /* add new group */ |
42 | ||
d8bd5fb9 | 43 | $this->openCiviPage('group/add', 'reset=1', '_qf_Edit_upload'); |
6a488035 TO |
44 | |
45 | $groupName = 'group_' . substr(sha1(rand()), 0, 7); | |
46 | $this->type("title", $groupName); | |
47 | ||
48 | // fill description | |
49 | $this->type("description", "Adding new group."); | |
50 | ||
51 | // check Access Control | |
52 | $this->click("group_type[1]"); | |
53 | ||
54 | // Clicking save. | |
55 | $this->click("_qf_Edit_upload"); | |
56 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
57 | ||
58 | /* add contacts */ | |
59 | ||
60 | // Individual 1 | |
61 | $contact1 = substr(sha1(rand()), 0, 7); | |
62 | $this->webtestAddContact($contact1, "AAA", "{$contact1}@example.com"); | |
63 | ||
64 | // Add Individual 1 to group | |
65 | $this->click('css=li#tab_group a'); | |
66 | $this->waitForElementPresent('_qf_GroupContact_next'); | |
67 | $this->select('group_id', "label={$groupName}"); | |
68 | $this->click('_qf_GroupContact_next'); | |
6c5f7368 | 69 | $this->waitForText('crm-notification-container', "Added to Group"); |
6a488035 TO |
70 | |
71 | // Individual 2 | |
72 | $contact2 = substr(sha1(rand()), 0, 7); | |
73 | $this->webtestAddContact($contact2, "BBB", "{$contact2}@example.com"); | |
74 | ||
75 | // Add Individual 2 to group | |
76 | $this->click('css=li#tab_group a'); | |
77 | $this->waitForElementPresent('_qf_GroupContact_next'); | |
78 | $this->select('group_id', "label={$groupName}"); | |
79 | $this->click('_qf_GroupContact_next'); | |
6c5f7368 | 80 | $this->waitForText('crm-notification-container', "Added to Group"); |
6a488035 TO |
81 | |
82 | // Individual 3 | |
83 | $contact3 = substr(sha1(rand()), 0, 7); | |
84 | $this->webtestAddContact($contact3, "CCC", "{$contact3}@example.com"); | |
85 | ||
86 | // Add Individual 3 to group | |
87 | $this->click('css=li#tab_group a'); | |
88 | $this->waitForElementPresent('_qf_GroupContact_next'); | |
89 | $this->select('group_id', "label={$groupName}"); | |
90 | $this->click('_qf_GroupContact_next'); | |
6c5f7368 | 91 | $this->waitForText('crm-notification-container', "Added to Group"); |
6a488035 TO |
92 | |
93 | // Search contacts | |
d8bd5fb9 | 94 | $this->openCiviPage('contact/search', 'reset=1', '_qf_Basic_refresh'); |
6a488035 TO |
95 | |
96 | $this->select('group', "label={$groupName}"); | |
97 | $this->click("_qf_Basic_refresh"); | |
98 | $this->waitForPageToLoad(2 * $this->getTimeoutMsec()); | |
d8bd5fb9 | 99 | $this->assertElementContainsText('search-status', "3 Contacts"); |
6a488035 TO |
100 | |
101 | $this->click("xpath=//div[@class='crm-search-results']//table/tbody/tr[1]/td[3]/a"); | |
102 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
103 | ||
d8bd5fb9 RN |
104 | $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact1} AAA"); |
105 | $this->assertElementContainsText('css=li.crm-next-action a span', "Next"); | |
6a488035 TO |
106 | |
107 | $this->click("xpath=//ul[@id='actions']/li[@class='crm-next-action']/a"); | |
108 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
d8bd5fb9 RN |
109 | $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact2} BBB"); |
110 | $this->assertElementContainsText('css=li.crm-next-action a span', "Next"); | |
111 | $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous"); | |
6a488035 TO |
112 | |
113 | $this->click("xpath=//ul[@id='actions']/li[@class='crm-next-action']/a"); | |
114 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
d8bd5fb9 RN |
115 | $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact3} CCC"); |
116 | $this->assertElementContainsText('css=li.crm-previous-action a span', "Previous"); | |
6a488035 TO |
117 | |
118 | $this->click("xpath=//ul[@id='actions']/li[@class='crm-previous-action']/a"); | |
119 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
d8bd5fb9 RN |
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"); | |
6a488035 TO |
123 | |
124 | $this->click("xpath=//ul[@id='actions']/li[@class='crm-previous-action']/a"); | |
125 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
d8bd5fb9 RN |
126 | $this->assertElementContainsText('css=div.crm-summary-display_name', "{$contact1} AAA"); |
127 | $this->assertElementContainsText('css=li.crm-next-action a span', "Next"); | |
6a488035 | 128 | } |
96025800 | 129 | |
6a488035 | 130 | } |