66b10532f61cfa5ea9d4a5a28cff9fb5c4fa541c
[civicrm-core.git] / tests / phpunit / WebTest / Generic / GeneralClickAroundTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
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 public function login() {
39 $this->webtestLogin();
40 $this->openCiviPage('');
41 }
42
43 public function testSearchMenu() {
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 IN '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");
62 $this->waitForElementPresent('contact_tags');
63 $this->select('contact_tags', 'label=Major Donor');
64 $this->click('_qf_Advanced_refresh');
65 $this->waitForElementPresent('search-status');
66 $this->assertText('search-status', 'Tagged IN Major Donor');
67 }
68
69 public function testNewIndividual() {
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
90 public function testManageGroups() {
91 $this->login();
92
93 // Contacts → Manage Groups
94 $this->click("//ul[@id='civicrm-menu']/li[4]");
95 $this->clickLink("xpath=//div[@id='root-menu-div']//div/ul//li/div/a[text()='Manage Groups']");
96
97 $this->assertTextPresent("Find Groups");
98 $this->assertElementPresent("title");
99 $this->assertTextPresent("Access Control");
100 $this->waitForElementPresent('link=Settings');
101 $this->assertTextPresent("Administrators");
102 $this->assertTextPresent("Add Group");
103 }
104
105 public function testContributionDashboard() {
106 $this->webtestLogin();
107 // Enable CiviContribute module if necessary
108 $this->enableComponents("CiviContribute");
109
110 // Contributions → Dashboard
111 $this->click("css=ul#civicrm-menu li.crm-Contributions");
112 $this->clickLink("css=ul#civicrm-menu li.crm-Contributions li.crm-Dashboard a");
113
114 $this->waitForElementPresent("xpath=//*[@id='chart_view']/a");
115 $this->waitForElementPresent("xpath=//*[@id='ContributionCharts']/div[4]/div[3]");
116 $this->assertTextPresent("Contribution Summary");
117 $this->assertTextPresent("Recent Contributions");
118 }
119
120 public function testEventDashboard() {
121 $this->webtestLogin();
122
123 // Enable CiviEvent module if necessary
124 $this->enableComponents("CiviEvent");
125
126 // Events → Dashboard
127 $this->click("css=ul#civicrm-menu li.crm-Events");
128 $this->clickLink("css=ul#civicrm-menu li.crm-Events li.crm-Dashboard a");
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 public function testMembershipsDashboard() {
145 $this->webtestLogin();
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 public function testFindContributions() {
162 $this->webtestLogin();
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->clickLink("css=ul#civicrm-menu li.crm-Find_Contributions a");
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");
179 $this->assertElementPresent("s2id_contribution_or_softcredits");
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
186 public function testNewMailing() {
187 $this->webtestLogin();
188
189 // Enable CiviMail module if necessary
190 $this->enableComponents("CiviMail");
191
192 // configure default mail-box
193 $this->setupDefaultMailbox();
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");
198 $this->clickLink("css=ul#civicrm-menu li.crm-New_Mailing a");
199
200 $this->assertTextPresent("Mailing");
201 }
202
203 public function testConstituentReportSummary() {
204 $this->login();
205
206 // Constituent Report Summary
207 $this->click("css=ul#civicrm-menu li.crm-Reports");
208 $this->clickLink("css=ul#civicrm-menu li.crm-Contact_Reports a");
209
210 $this->clickLink("xpath=//div[@id='Contact']/table/tbody/tr/td[1]/a");
211
212 $this->assertTextPresent("Constituent Summary");
213 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[3]/a");
214 $this->waitForElementPresent("xpath=//div[@id='report-tab-set-filters']");
215 $this->assertTextPresent("Contact Name");
216 $this->assertTextPresent("Contact Source");
217 $this->assertTextPresent("Country");
218 $this->assertTextPresent("State/Province");
219 $this->assertTextPresent("Group");
220 $this->assertTextPresent("Tag");
221 $this->clickLink("_qf_Summary_submit");
222
223 $this->assertTextPresent("Row(s) Listed");
224 $this->assertTextPresent("Total Row(s)");
225 }
226
227 public function testCustomData() {
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");
232 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Custom Fields']");
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
240 $this->clickLink("//span[contains(text(), 'Add Set of Custom Fields')]");
241
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
249 public function testProfile() {
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");
255 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Profiles']");
256
257 $this->assertTextPresent("CiviCRM Profile");
258 // Verify Reserved Profiles
259
260 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[2]/a");
261 $this->waitForElementPresent("newCiviCRMProfile-bottom");
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
270 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[1]/a");
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");
287 $this->assertTextPresent("Proximity Search");
288 }
289
290 public function testTags() {
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");
296 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Tags (Categories)']");
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
306 public function testActivityTypes() {
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");
312 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Activity Types']");
313
314 // Verify activity types
315 $this->assertTextPresent("Meeting");
316 $this->assertTextPresent("Print PDF Letter");
317 $this->assertTextPresent("Event Registration");
318 $this->assertTextPresent("Contribution");
319 $this->assertTextPresent("Membership Signup");
320 }
321
322 public function testRelationshipTypes() {
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
329 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Relationship Types']");
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
340 public function testMessageTemplates() {
341 $this->markTestSkipped('Skipping for now as it works fine locally.');
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");
347 $this->clickLink("xpath=//div[@id='root-menu-div']//a[text()='Message Templates']");
348
349 // Verify message templates
350 $this->click("xpath=//div[@id='mainTabContainer']/ul//li/a[contains(text(),'System Workflow Messages')]");
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 }
358
359 }