copyright and version fixes
[civicrm-core.git] / tests / phpunit / WebTest / Generic / GeneralClickAroundTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
232624b1 4 | CiviCRM version 4.4 |
6a488035
TO
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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");
6e64f99d 59 $this->waitForElementPresent('css=select#crmasmSelect3');
6a488035
TO
60 $this->click('crmasmSelect3');
61 $this->select('crmasmSelect3', 'label=Major Donor');
62 $this->waitForElementPresent("//ul[@id='crmasmList3']/li/span");
63 $this->click('_qf_Advanced_refresh');
64 $this->waitForElementPresent('search-status');
65 $this->assertText('search-status', 'Tagged IN Major Donor');
66 }
67
68 function testNewIndividual() {
69 $this->login();
70
71 // Create New → Individual
72 $this->click("crm-create-new-link");
73 $this->click("link=Individual");
74 $this->waitForPageToLoad($this->getTimeoutMsec());
75
76 $this->assertElementPresent("first_name");
77 $this->assertElementPresent("email_1_email");
78 $this->assertElementPresent("phone_1_phone");
79 $this->assertElementPresent("contact_source");
80 $this->assertTextPresent("Constituent Information");
81 $this->click("//form[@id='Contact']/div[2]/div[4]/div[1]");
82 $this->click("//div[@id='customData1']/table/tbody/tr[1]/td[1]/label");
83 $this->assertTextPresent("Most Important Issue");
84 $this->click("//form[@id='Contact']/div[2]/div[6]/div[1]");
85 $this->assertTextPresent("Communication Preferences");
86 $this->assertTextPresent("Do not phone");
87 }
88
89 function testManageGroups() {
90 $this->login();
91
92 // Contacts → Manage Groups
93 $this->click("//ul[@id='civicrm-menu']/li[4]");
94 $this->click("xpath=//div[@id='root-menu-div']//div/ul//li/div/a[text()='Manage Groups']");
95 $this->waitForPageToLoad($this->getTimeoutMsec());
96
97 $this->assertTextPresent("Find Groups");
98 $this->assertElementPresent("title");
99 $this->assertTextPresent("Access Control");
100 $this->waitForElementPresent('link=Settings');
0caa4679 101 $this->assertTextPresent("Administrators");
6a488035
TO
102 $this->assertTextPresent("Add Group");
103 }
104
105 function testContributionDashboard() {
106 $this->login();
107 // Enable CiviContribute module if necessary
b9715b8a 108 $this->enableComponents("CiviContribute");
6a488035
TO
109
110 // Contributions → Dashboard
111 $this->click("css=ul#civicrm-menu li.crm-Contributions");
112 $this->click("css=ul#civicrm-menu li.crm-Contributions li.crm-Dashboard a");
fcd8033d 113 $this->waitForElementPresent('chart_type');
6a488035
TO
114
115 $this->assertTextPresent("Contribution Summary");
116 $this->assertTextPresent("Select Year (for monthly breakdown)");
117 $this->assertTextPresent("Recent Contributions");
118 $this->assertTextPresent("Find more contributions...");
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");
182 $this->assertElementPresent("contribution_in_honor_of");
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");
206 $this->assertElementPresent("includeGroups-f");
207 $this->assertElementPresent("excludeGroups-t");
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");
229 $this->assertTextPresent("State / Province");
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
273 $this->click("ui-id-2");
274 $this->assertTextPresent("New Household");
275 $this->assertTextPresent("New Individual");
276 $this->assertTextPresent("New Organization");
277 $this->assertTextPresent("Participant Status");
278 $this->assertTextPresent("Shared Address");
279 $this->assertTextPresent("Summary Overlay");
280
281 // Verify profiles that are not reserved
282 $this->click("ui-id-1");
283 $this->assertTextPresent("Name and Address");
284 $this->assertTextPresent("Supporter Profile");
285
286 // Verify create form
287 $this->click("//span[contains(text(), 'Add Profile')]");
288 $this->waitForPageToLoad($this->getTimeoutMsec());
289 $this->assertElementPresent("title");
290 $this->assertElementPresent("uf_group_type[Profile]");
291 $this->assertElementPresent("weight");
292 $this->assertTextPresent("Pre-form Help");
293 $this->assertTextPresent("Post-form Help");
294 $this->click("//form[@id='Group']/div[2]/div[2]/div/div");
295 $this->assertElementPresent("group");
296 $this->assertElementPresent("post_URL");
297 $this->assertTextPresent("Drupal user account registration option?");
298 $this->assertTextPresent("What to do upon duplicate match");
299 $this->assertTextPresent("Proximity search");
300 }
301
302 function testTags() {
303 $this->login();
304
305 // Use class names for menu items since li array can change based on which components are enabled
306 $this->click("css=ul#civicrm-menu li.crm-Administer");
307 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
308 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Tags (Categories)']");
309
310 $this->waitForPageToLoad($this->getTimeoutMsec());
311
312 // Verify tags
313 $this->assertTextPresent("Non-profit");
314 $this->assertTextPresent("Company");
315 $this->assertTextPresent("Government Entity");
316 $this->assertTextPresent("Major Donor");
317 $this->assertTextPresent("Volunteer");
318 }
319
320 function testActivityTypes() {
321 $this->login();
322
323 // Use class names for menu items since li array can change based on which components are enabled
324 $this->click("css=ul#civicrm-menu li.crm-Administer");
325 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
326 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']");
327
328 $this->waitForPageToLoad($this->getTimeoutMsec());
329
330 // Verify activity types
331 $this->assertTextPresent("Meeting");
332 $this->assertTextPresent("Print PDF Letter");
333 $this->assertTextPresent("Event Registration");
334 $this->assertTextPresent("Contribution");
335 $this->assertTextPresent("Membership Signup");
336 }
337
338 function testRelationshipTypes() {
339 $this->login();
340
341 // Use class names for menu items since li array can change based on which components are enabled
342 $this->click("css=ul#civicrm-menu li.crm-Administer");
343 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
344 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Relationship Types']");
345
346 $this->waitForPageToLoad($this->getTimeoutMsec());
347
348 // Verify relationship types
349 $this->assertTextPresent("Child of");
350 $this->assertTextPresent("Head of Household for");
351 $this->assertTextPresent("Sibling of");
352 $this->assertTextPresent("Spouse of");
353 $this->assertTextPresent("Supervised by");
354 $this->assertTextPresent("Volunteer for");
355 }
356
357 function testMessageTemplates() {
358 $this->login();
359
360 // Use class names for menu items since li array can change based on which components are enabled
361 $this->click("css=ul#civicrm-menu li.crm-Administer");
362 $this->click("css=ul#civicrm-menu li.crm-Communications");
363 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Message Templates']");
364 $this->waitForPageToLoad($this->getTimeoutMsec());
365
366 // Verify message templates
367 $this->click("//a[contains(text(),'System Workflow Messages')]");
368 $this->assertTextPresent("Contributions - Receipt (on-line)");
369 $this->assertTextPresent("Events - Registration Confirmation and Receipt (off-line)");
370 $this->assertTextPresent("Memberships - Signup and Renewal Receipts (off-line)");
371 $this->assertTextPresent("Personal Campaign Pages - Supporter Status Change Notification");
372 $this->assertTextPresent("Profiles - Admin Notification");
373 $this->assertTextPresent("Tell-a-Friend Email");
374 }
375}
376