Merge pull request #2924 from colemanw/explorer
[civicrm-core.git] / tests / phpunit / WebTest / Generic / GeneralClickAroundTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
06a1bc01 4 | CiviCRM version 4.5 |
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 +--------------------------------------------------------------------+
25*/
26
6a488035
TO
27require_once 'CiviTest/CiviSeleniumTestCase.php';
28class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
29
30 protected function setUp() {
31 parent::setUp();
32 }
33
34 function login() {
6a488035 35 $this->webtestLogin();
6a488035
TO
36 $this->click("//a[contains(text(),'CiviCRM')]");
37 $this->waitForPageToLoad($this->getTimeoutMsec());
38 }
39
40 function testSearchMenu() {
41 $this->login();
42 // click Search -> Find Contacts
43 // Use class names for menu items since li array can change based on which components are enabled
44 $this->click("css=ul#civicrm-menu li.crm-Search");
45 $this->click("css=ul#civicrm-menu li.crm-Find_Contacts a");
46 $this->waitForElementPresent('tag');
47
48 $this->click('contact_type');
49 $this->select('contact_type', 'label=Individual');
50 $this->select('tag', 'label=Major Donor');
51 $this->click('_qf_Basic_refresh');
52 $this->waitForElementPresent('search-status');
53 $this->assertText('search-status', "Contact Type - 'Individual'");
54 $this->assertText('search-status', 'Tagged IN Major Donor');
55
56 // Advanced Search by Tag
57 $this->click("css=ul#civicrm-menu li.crm-Search");
58 $this->click("css=ul#civicrm-menu li.crm-Advanced_Search a");
3379d026 59 $this->waitForElementPresent('contact_tags');
60 $this->select('contact_tags', 'label=Major Donor');
6a488035
TO
61 $this->click('_qf_Advanced_refresh');
62 $this->waitForElementPresent('search-status');
63 $this->assertText('search-status', 'Tagged IN Major Donor');
64 }
65
66 function testNewIndividual() {
67 $this->login();
68
69 // Create New → Individual
3bbf7318 70 $this->waitForElementPresent("xpath=//*[@id='crm-create-new-link']");
6a488035
TO
71 $this->click("crm-create-new-link");
72 $this->click("link=Individual");
73 $this->waitForPageToLoad($this->getTimeoutMsec());
74
75 $this->assertElementPresent("first_name");
76 $this->assertElementPresent("email_1_email");
77 $this->assertElementPresent("phone_1_phone");
78 $this->assertElementPresent("contact_source");
79 $this->assertTextPresent("Constituent Information");
80 $this->click("//form[@id='Contact']/div[2]/div[4]/div[1]");
81 $this->click("//div[@id='customData1']/table/tbody/tr[1]/td[1]/label");
82 $this->assertTextPresent("Most Important Issue");
83 $this->click("//form[@id='Contact']/div[2]/div[6]/div[1]");
84 $this->assertTextPresent("Communication Preferences");
85 $this->assertTextPresent("Do not phone");
86 }
87
88 function testManageGroups() {
89 $this->login();
90
91 // Contacts → Manage Groups
92 $this->click("//ul[@id='civicrm-menu']/li[4]");
93 $this->click("xpath=//div[@id='root-menu-div']//div/ul//li/div/a[text()='Manage Groups']");
94 $this->waitForPageToLoad($this->getTimeoutMsec());
95
96 $this->assertTextPresent("Find Groups");
97 $this->assertElementPresent("title");
98 $this->assertTextPresent("Access Control");
99 $this->waitForElementPresent('link=Settings');
0caa4679 100 $this->assertTextPresent("Administrators");
6a488035
TO
101 $this->assertTextPresent("Add Group");
102 }
103
104 function testContributionDashboard() {
105 $this->login();
106 // Enable CiviContribute module if necessary
b9715b8a 107 $this->enableComponents("CiviContribute");
6a488035
TO
108
109 // Contributions → Dashboard
110 $this->click("css=ul#civicrm-menu li.crm-Contributions");
111 $this->click("css=ul#civicrm-menu li.crm-Contributions li.crm-Dashboard a");
fcd8033d 112 $this->waitForElementPresent('chart_type');
6a488035
TO
113
114 $this->assertTextPresent("Contribution Summary");
115 $this->assertTextPresent("Select Year (for monthly breakdown)");
116 $this->assertTextPresent("Recent Contributions");
117 $this->assertTextPresent("Find more contributions...");
118 }
119
120 function testEventDashboard() {
121 $this->login();
122
123 // Enable CiviEvent module if necessary
b9715b8a 124 $this->enableComponents("CiviEvent");
6a488035
TO
125
126 // Events → Dashboard
127 $this->click("css=ul#civicrm-menu li.crm-Events");
128 $this->click("css=ul#civicrm-menu li.crm-Events li.crm-Dashboard a");
129 $this->waitForPageToLoad($this->getTimeoutMsec());
130
131 $this->assertTextPresent("Event Summary");
6a488035
TO
132 $this->assertTextPresent("Counted:");
133 $this->assertTextPresent("Not Counted:");
134 $this->assertTextPresent("Not Counted Due To Status:");
135 $this->assertTextPresent("Not Counted Due To Role:");
136 $this->assertTextPresent("Registered:");
137 $this->assertTextPresent("Attended:");
138 $this->assertTextPresent("No-show:");
139 $this->assertTextPresent("Cancelled:");
140 $this->assertTextPresent("Recent Registrations");
141 $this->assertTextPresent("Find more event participants...");
699e3485 142 $this->assertTextPresent("Configure");
6a488035
TO
143 }
144
145 function testMembershipsDashboard() {
146 $this->login();
147
148 // Enable CiviMember module if necessary
b9715b8a 149 $this->enableComponents("CiviMember");
6a488035
TO
150
151 // Memberships → Dashboard
152 $this->click("css=ul#civicrm-menu li.crm-Memberships");
153 $this->click("css=ul#civicrm-menu li.crm-Memberships li.crm-Dashboard a");
154 $this->waitForPageToLoad($this->getTimeoutMsec());
155
156 $this->assertTextPresent("Membership Summary");
157 $this->assertTextPresent("Members by Type");
158 $this->assertTextPresent("Recent Memberships");
159 $this->assertTextPresent("Find more members...");
160 }
161
162 function testFindContributions() {
163 $this->login();
164
165 // Enable CiviContribute module if necessary
b9715b8a 166 $this->enableComponents("CiviContribute");
6a488035
TO
167
168 // Search → Find Contributions
169 // Use class names for menu items since li array can change based on which components are enabled
170 $this->click("css=ul#civicrm-menu li.crm-Search");
171 $this->click("css=ul#civicrm-menu li.crm-Find_Contributions a");
172 $this->waitForPageToLoad($this->getTimeoutMsec());
173
174 $this->assertTextPresent("Edit Search Criteria");
175 $this->assertElementPresent("sort_name");
176 $this->assertElementPresent("contribution_date_low");
177 $this->assertElementPresent("contribution_amount_low");
178 $this->assertElementPresent("contribution_check_number");
179 $this->assertTextPresent("Financial Type");
180 $this->assertTextPresent("Contribution Page");
3379d026 181 $this->assertElementPresent("s2id_contribution_or_softcredits");
6a488035
TO
182 $this->assertElementPresent("contribution_source");
183 $this->assertTextPresent("Personal Campaign Page");
184 $this->assertTextPresent("Personal Campaign Page Honor Roll");
185 $this->assertTextPresent("Currency");
186 }
187
188 function testNewMailing() {
189 $this->login();
190
191 // Enable CiviMail module if necessary
b9715b8a 192 $this->enableComponents("CiviMail");
6a488035
TO
193
194 // configure default mail-box
5ff68892 195 $this->setupDefaultMailbox();
6a488035
TO
196
197 // New Mailing Form
198 // Use class names for menu items since li array can change based on which components are enabled
199 $this->click("css=ul#civicrm-menu li.crm-Mailings");
200 $this->click("css=ul#civicrm-menu li.crm-New_Mailing a");
201 $this->waitForPageToLoad($this->getTimeoutMsec());
202
6a488035
TO
203 $this->assertTextPresent("New Mailing");
204 $this->assertElementPresent("name");
205 $this->assertElementPresent("includeGroups-f");
206 $this->assertElementPresent("excludeGroups-t");
207 }
208
209 function testConstituentReportSummary() {
210 $this->login();
211
212 // Constituent Report Summary
213 $this->click("css=ul#civicrm-menu li.crm-Reports");
214 $this->click("css=ul#civicrm-menu li.crm-Contact_Reports a");
215 $this->waitForPageToLoad($this->getTimeoutMsec());
216 $this->click("xpath=//div[@id='Contact']/table/tbody/tr/td/a");
217 $this->waitForPageToLoad($this->getTimeoutMsec());
218
219 $this->assertTextPresent("Constituent Summary");
220 $this->click("//form[@id='Summary']/div[2]/div/div/div/div");
221 $this->assertTextPresent("Display Columns");
222 $this->click("//form[@id='Summary']/div[2]//div[@id='id_default']/div/div/div");
223 $this->assertTextPresent("Most Important Issue");
224 $this->assertTextPresent("Set Filters");
225 $this->assertTextPresent("Contact Name");
226 $this->assertTextPresent("Contact Source");
227 $this->assertTextPresent("Country");
228 $this->assertTextPresent("State / Province");
229 $this->assertTextPresent("Group");
230 $this->assertTextPresent("Tag");
231 $this->click("_qf_Summary_submit");
232 $this->waitForElementPresent("_qf_Summary_submit_print");
233 $this->assertTextPresent("Row(s) Listed");
234 $this->assertTextPresent("Total Row(s)");
235 }
236
237 function testCustomData() {
238 $this->login();
239
240 // Use class names for menu items since li array can change based on which components are enabled
241 $this->click("css=ul#civicrm-menu li.crm-Administer");
242 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Custom Fields']");
243 $this->waitForPageToLoad($this->getTimeoutMsec());
244
245 $this->assertTextPresent("Custom Data");
246 $this->assertTextPresent("Constituent Information");
247 $this->assertTextPresent("Donor Information");
248 $this->assertTextPresent("Food Preference");
249
250 // Verify create form
251 $this->click("//span[contains(text(), 'Add Set of Custom Fields')]");
252 $this->waitForPageToLoad($this->getTimeoutMsec());
253 $this->assertElementPresent("title");
254 $this->assertElementPresent("extends[0]");
255 $this->assertElementPresent("weight");
256 $this->assertTextPresent("Pre-form Help");
257 $this->assertTextPresent("Post-form Help");
258 }
259
260 function testProfile() {
261 $this->login();
262
263 // Use class names for menu items since li array can change based on which components are enabled
264 $this->click("css=ul#civicrm-menu li.crm-Administer");
265 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
266 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Profiles']");
267
268 $this->waitForPageToLoad($this->getTimeoutMsec());
269
270 $this->assertTextPresent("CiviCRM Profile");
271 // Verify Reserved Profiles
3379d026 272 $this->click("ui-id-3");
6a488035
TO
273 $this->assertTextPresent("New Household");
274 $this->assertTextPresent("New Individual");
275 $this->assertTextPresent("New Organization");
276 $this->assertTextPresent("Participant Status");
277 $this->assertTextPresent("Shared Address");
278 $this->assertTextPresent("Summary Overlay");
279
280 // Verify profiles that are not reserved
3379d026 281 $this->click("ui-id-2");
6a488035
TO
282 $this->assertTextPresent("Name and Address");
283 $this->assertTextPresent("Supporter Profile");
284
285 // Verify create form
286 $this->click("//span[contains(text(), 'Add Profile')]");
287 $this->waitForPageToLoad($this->getTimeoutMsec());
288 $this->assertElementPresent("title");
289 $this->assertElementPresent("uf_group_type[Profile]");
290 $this->assertElementPresent("weight");
291 $this->assertTextPresent("Pre-form Help");
292 $this->assertTextPresent("Post-form Help");
293 $this->click("//form[@id='Group']/div[2]/div[2]/div/div");
294 $this->assertElementPresent("group");
295 $this->assertElementPresent("post_URL");
296 $this->assertTextPresent("Drupal user account registration option?");
297 $this->assertTextPresent("What to do upon duplicate match");
298 $this->assertTextPresent("Proximity search");
299 }
300
301 function testTags() {
302 $this->login();
303
304 // Use class names for menu items since li array can change based on which components are enabled
305 $this->click("css=ul#civicrm-menu li.crm-Administer");
306 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
307 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Tags (Categories)']");
308
309 $this->waitForPageToLoad($this->getTimeoutMsec());
310
311 // Verify tags
312 $this->assertTextPresent("Non-profit");
313 $this->assertTextPresent("Company");
314 $this->assertTextPresent("Government Entity");
315 $this->assertTextPresent("Major Donor");
316 $this->assertTextPresent("Volunteer");
317 }
318
319 function testActivityTypes() {
320 $this->login();
321
322 // Use class names for menu items since li array can change based on which components are enabled
323 $this->click("css=ul#civicrm-menu li.crm-Administer");
324 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
325 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']");
326
327 $this->waitForPageToLoad($this->getTimeoutMsec());
328
329 // Verify activity types
330 $this->assertTextPresent("Meeting");
331 $this->assertTextPresent("Print PDF Letter");
332 $this->assertTextPresent("Event Registration");
333 $this->assertTextPresent("Contribution");
334 $this->assertTextPresent("Membership Signup");
335 }
336
337 function testRelationshipTypes() {
338 $this->login();
339
340 // Use class names for menu items since li array can change based on which components are enabled
341 $this->click("css=ul#civicrm-menu li.crm-Administer");
342 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
343 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Relationship Types']");
344
345 $this->waitForPageToLoad($this->getTimeoutMsec());
346
347 // Verify relationship types
348 $this->assertTextPresent("Child of");
349 $this->assertTextPresent("Head of Household for");
350 $this->assertTextPresent("Sibling of");
351 $this->assertTextPresent("Spouse of");
352 $this->assertTextPresent("Supervised by");
353 $this->assertTextPresent("Volunteer for");
354 }
355
356 function testMessageTemplates() {
357 $this->login();
358
359 // Use class names for menu items since li array can change based on which components are enabled
360 $this->click("css=ul#civicrm-menu li.crm-Administer");
361 $this->click("css=ul#civicrm-menu li.crm-Communications");
362 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Message Templates']");
363 $this->waitForPageToLoad($this->getTimeoutMsec());
364
365 // Verify message templates
366 $this->click("//a[contains(text(),'System Workflow Messages')]");
367 $this->assertTextPresent("Contributions - Receipt (on-line)");
368 $this->assertTextPresent("Events - Registration Confirmation and Receipt (off-line)");
369 $this->assertTextPresent("Memberships - Signup and Renewal Receipts (off-line)");
370 $this->assertTextPresent("Personal Campaign Pages - Supporter Status Change Notification");
371 $this->assertTextPresent("Profiles - Admin Notification");
372 $this->assertTextPresent("Tell-a-Friend Email");
373 }
374}
375