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