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