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