Merge pull request #11813 from seanmadsen/add-survey-pre-post-hooks
[civicrm-core.git] / tests / phpunit / WebTest / Generic / GeneralClickAroundTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
81621fee 4 | CiviCRM version 4.7 |
6a488035 5 +--------------------------------------------------------------------+
8c9251b3 6 | Copyright CiviCRM LLC (c) 2004-2018 |
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 +--------------------------------------------------------------------+
d25dd0ee 25 */
6a488035 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');
c432c016 56 $this->assertText('search-status', "Contact Type In Individual");
57 $this->assertText('search-status', 'Tagged = Major Donor');
6a488035
TO
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');
c432c016 66 $this->assertText('search-status', 'Tagged In Major Donor');
6a488035
TO
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
752b08dc 200 $this->assertTextPresent("Mailing");
6a488035
TO
201 }
202
00be9182 203 public function testConstituentReportSummary() {
6a488035
TO
204 $this->login();
205
206 // Constituent Report Summary
207 $this->click("css=ul#civicrm-menu li.crm-Reports");
e739afc3
CW
208 $this->clickLink("css=ul#civicrm-menu li.crm-Contact_Reports a");
209
f78f9745 210 $this->clickLink("xpath=//div[@id='Contact']/table/tbody/tr/td[1]/a");
6a488035
TO
211
212 $this->assertTextPresent("Constituent Summary");
f78f9745
RK
213 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[3]/a");
214 $this->waitForElementPresent("xpath=//div[@id='report-tab-set-filters']");
6a488035
TO
215 $this->assertTextPresent("Contact Name");
216 $this->assertTextPresent("Contact Source");
217 $this->assertTextPresent("Country");
757069de 218 $this->assertTextPresent("State/Province");
6a488035
TO
219 $this->assertTextPresent("Group");
220 $this->assertTextPresent("Tag");
e739afc3
CW
221 $this->clickLink("_qf_Summary_submit");
222
6a488035
TO
223 $this->assertTextPresent("Row(s) Listed");
224 $this->assertTextPresent("Total Row(s)");
225 }
226
00be9182 227 public function testCustomData() {
6a488035
TO
228 $this->login();
229
230 // Use class names for menu items since li array can change based on which components are enabled
231 $this->click("css=ul#civicrm-menu li.crm-Administer");
e739afc3 232 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Custom Fields']");
6a488035
TO
233
234 $this->assertTextPresent("Custom Data");
235 $this->assertTextPresent("Constituent Information");
236 $this->assertTextPresent("Donor Information");
237 $this->assertTextPresent("Food Preference");
238
239 // Verify create form
e739afc3
CW
240 $this->clickLink("//span[contains(text(), 'Add Set of Custom Fields')]");
241
6a488035
TO
242 $this->assertElementPresent("title");
243 $this->assertElementPresent("extends[0]");
244 $this->assertElementPresent("weight");
245 $this->assertTextPresent("Pre-form Help");
246 $this->assertTextPresent("Post-form Help");
247 }
248
00be9182 249 public function testProfile() {
6a488035
TO
250 $this->login();
251
252 // Use class names for menu items since li array can change based on which components are enabled
253 $this->click("css=ul#civicrm-menu li.crm-Administer");
254 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
e739afc3 255 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Profiles']");
6a488035 256
6a488035
TO
257 $this->assertTextPresent("CiviCRM Profile");
258 // Verify Reserved Profiles
8bee7c91
RK
259
260 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[2]/a");
261 $this->waitForElementPresent("newCiviCRMProfile-bottom");
6a488035
TO
262 $this->assertTextPresent("New Household");
263 $this->assertTextPresent("New Individual");
264 $this->assertTextPresent("New Organization");
265 $this->assertTextPresent("Participant Status");
266 $this->assertTextPresent("Shared Address");
267 $this->assertTextPresent("Summary Overlay");
268
269 // Verify profiles that are not reserved
8bee7c91 270 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[1]/a");
6a488035
TO
271 $this->assertTextPresent("Name and Address");
272 $this->assertTextPresent("Supporter Profile");
273
274 // Verify create form
275 $this->click("//span[contains(text(), 'Add Profile')]");
276 $this->waitForPageToLoad($this->getTimeoutMsec());
277 $this->assertElementPresent("title");
278 $this->assertElementPresent("uf_group_type[Profile]");
279 $this->assertElementPresent("weight");
280 $this->assertTextPresent("Pre-form Help");
281 $this->assertTextPresent("Post-form Help");
282 $this->click("//form[@id='Group']/div[2]/div[2]/div/div");
283 $this->assertElementPresent("group");
284 $this->assertElementPresent("post_URL");
285 $this->assertTextPresent("Drupal user account registration option?");
286 $this->assertTextPresent("What to do upon duplicate match");
8e3d52a4 287 $this->assertTextPresent("Proximity Search");
6a488035
TO
288 }
289
00be9182 290 public function testTags() {
6a488035
TO
291 $this->login();
292
293 // Use class names for menu items since li array can change based on which components are enabled
294 $this->click("css=ul#civicrm-menu li.crm-Administer");
295 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
e739afc3 296 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Tags (Categories)']");
6a488035
TO
297
298 // Verify tags
299 $this->assertTextPresent("Non-profit");
300 $this->assertTextPresent("Company");
301 $this->assertTextPresent("Government Entity");
302 $this->assertTextPresent("Major Donor");
303 $this->assertTextPresent("Volunteer");
304 }
305
00be9182 306 public function testActivityTypes() {
6a488035
TO
307 $this->login();
308
309 // Use class names for menu items since li array can change based on which components are enabled
310 $this->click("css=ul#civicrm-menu li.crm-Administer");
311 $this->click("css=ul#civicrm-menu li.crm-Customize_Data_and_Screens");
e739afc3 312 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']");
6a488035 313
6a488035
TO
314 // Verify activity types
315 $this->assertTextPresent("Meeting");
cd095eae 316 $this->assertTextPresent("Print/Merge Document");
6a488035
TO
317 $this->assertTextPresent("Event Registration");
318 $this->assertTextPresent("Contribution");
319 $this->assertTextPresent("Membership Signup");
320 }
321
00be9182 322 public function testRelationshipTypes() {
6a488035
TO
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");
6a488035 328
e739afc3 329 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Relationship Types']");
6a488035
TO
330
331 // Verify relationship types
332 $this->assertTextPresent("Child of");
333 $this->assertTextPresent("Head of Household for");
334 $this->assertTextPresent("Sibling of");
335 $this->assertTextPresent("Spouse of");
336 $this->assertTextPresent("Supervised by");
337 $this->assertTextPresent("Volunteer for");
338 }
339
00be9182 340 public function testMessageTemplates() {
a49e5dea 341 $this->markTestSkipped('Skipping for now as it works fine locally.');
6a488035
TO
342 $this->login();
343
344 // Use class names for menu items since li array can change based on which components are enabled
345 $this->click("css=ul#civicrm-menu li.crm-Administer");
346 $this->click("css=ul#civicrm-menu li.crm-Communications");
e739afc3 347 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Message Templates']");
6a488035
TO
348
349 // Verify message templates
3d4f16de 350 $this->click("xpath=//div[@id='mainTabContainer']/ul//li/a[contains(text(),'System Workflow Messages')]");
6a488035
TO
351 $this->assertTextPresent("Contributions - Receipt (on-line)");
352 $this->assertTextPresent("Events - Registration Confirmation and Receipt (off-line)");
353 $this->assertTextPresent("Memberships - Signup and Renewal Receipts (off-line)");
354 $this->assertTextPresent("Personal Campaign Pages - Supporter Status Change Notification");
355 $this->assertTextPresent("Profiles - Admin Notification");
356 $this->assertTextPresent("Tell-a-Friend Email");
357 }
96025800 358
6a488035 359}