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