Merge pull request #3339 from yashodha/CRM-14664
[civicrm-core.git] / tests / phpunit / WebTest / Generic / GeneralClickAroundTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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 require_once 'CiviTest/CiviSeleniumTestCase.php';
28
29 /**
30 * Class WebTest_Generic_GeneralClickAroundTest
31 */
32 class WebTest_Generic_GeneralClickAroundTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
38 function login() {
39 $this->webtestLogin();
40 $this->open($this->sboxPath . "civicrm");
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");
63 $this->waitForElementPresent('contact_tags');
64 $this->select('contact_tags', 'label=Major Donor');
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("Administrators");
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->waitForElementPresent('chart_type');
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("Counted:");
136 $this->assertTextPresent("Not Counted:");
137 $this->assertTextPresent("Not Counted Due To Status:");
138 $this->assertTextPresent("Not Counted Due To Role:");
139 $this->assertTextPresent("Registered:");
140 $this->assertTextPresent("Attended:");
141 $this->assertTextPresent("No-show:");
142 $this->assertTextPresent("Cancelled:");
143 $this->assertTextPresent("Recent Registrations");
144 $this->assertTextPresent("Find more event participants...");
145 $this->assertTextPresent("Configure");
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("s2id_contribution_or_softcredits");
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->setupDefaultMailbox();
199
200 // New Mailing Form
201 // Use class names for menu items since li array can change based on which components are enabled
202 $this->click("css=ul#civicrm-menu li.crm-Mailings");
203 $this->click("css=ul#civicrm-menu li.crm-New_Mailing a");
204 $this->waitForPageToLoad($this->getTimeoutMsec());
205
206 $this->assertTextPresent("New Mailing");
207 $this->assertElementPresent("name");
208 $this->assertElementPresent("includeGroups-f");
209 $this->assertElementPresent("excludeGroups-t");
210 }
211
212 function testConstituentReportSummary() {
213 $this->login();
214
215 // Constituent Report Summary
216 $this->click("css=ul#civicrm-menu li.crm-Reports");
217 $this->click("css=ul#civicrm-menu li.crm-Contact_Reports a");
218 $this->waitForPageToLoad($this->getTimeoutMsec());
219 $this->click("xpath=//div[@id='Contact']/table/tbody/tr/td/a");
220 $this->waitForPageToLoad($this->getTimeoutMsec());
221
222 $this->assertTextPresent("Constituent Summary");
223 $this->click("//form[@id='Summary']/div[2]/div/div/div/div");
224 $this->assertTextPresent("Display Columns");
225 $this->click("//form[@id='Summary']/div[2]//div[@id='id_default']/div/div/div");
226 $this->assertTextPresent("Most Important Issue");
227 $this->assertTextPresent("Set Filters");
228 $this->assertTextPresent("Contact Name");
229 $this->assertTextPresent("Contact Source");
230 $this->assertTextPresent("Country");
231 $this->assertTextPresent("State / Province");
232 $this->assertTextPresent("Group");
233 $this->assertTextPresent("Tag");
234 $this->click("_qf_Summary_submit");
235 $this->waitForElementPresent("_qf_Summary_submit_print");
236 $this->assertTextPresent("Row(s) Listed");
237 $this->assertTextPresent("Total Row(s)");
238 }
239
240 function testCustomData() {
241 $this->login();
242
243 // Use class names for menu items since li array can change based on which components are enabled
244 $this->click("css=ul#civicrm-menu li.crm-Administer");
245 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Custom Fields']");
246 $this->waitForPageToLoad($this->getTimeoutMsec());
247
248 $this->assertTextPresent("Custom Data");
249 $this->assertTextPresent("Constituent Information");
250 $this->assertTextPresent("Donor Information");
251 $this->assertTextPresent("Food Preference");
252
253 // Verify create form
254 $this->click("//span[contains(text(), 'Add Set of Custom Fields')]");
255 $this->waitForPageToLoad($this->getTimeoutMsec());
256 $this->assertElementPresent("title");
257 $this->assertElementPresent("extends[0]");
258 $this->assertElementPresent("weight");
259 $this->assertTextPresent("Pre-form Help");
260 $this->assertTextPresent("Post-form Help");
261 }
262
263 function testProfile() {
264 $this->login();
265
266 // Use class names for menu items since li array can change based on which components are enabled
267 $this->click("css=ul#civicrm-menu li.crm-Administer");
268 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
269 $this->click("xpath=//div[@id='root-menu-div']//a[text()='Profiles']");
270
271 $this->waitForPageToLoad($this->getTimeoutMsec());
272
273 $this->assertTextPresent("CiviCRM Profile");
274 // Verify Reserved Profiles
275 $this->click("ui-id-3");
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
284 $this->click("ui-id-2");
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