Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06a1bc01 | 4 | | CiviCRM version 4.5 | |
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 TO |
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
28 | class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected function setUp() { | |
31 | parent::setUp(); | |
32 | } | |
33 | ||
34 | function testAddPaidEventNoTemplate() { | |
6a488035 TO |
35 | // Log in using webtestLogin() method |
36 | $this->webtestLogin(); | |
37 | ||
38 | // We need a payment processor | |
39 | $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); | |
40 | $this->webtestAddPaymentProcessor($processorName); | |
41 | ||
071a6d2e | 42 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
43 | |
44 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
45 | $eventDescription = "Here is a description for this conference."; | |
46 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
47 | ||
48 | $streetAddress = "100 Main Street"; | |
49 | $this->_testAddLocation($streetAddress); | |
50 | ||
51 | $this->_testAddReminder($eventTitle); | |
52 | ||
53 | $this->_testAddFees(FALSE, FALSE, $processorName); | |
54 | ||
55 | // intro text for registration page | |
56 | $registerIntro = "Fill in all the fields below and click Continue."; | |
57 | $multipleRegistrations = TRUE; | |
58 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
59 | ||
60 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); | |
05f3c31c | 61 | $eventId = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings); |
6a488035 TO |
62 | |
63 | $registerStrings = array("225.00", "Member", "300.00", "Non-member", $registerIntro); | |
64 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
65 | ||
66 | $numberRegistrations = 3; | |
67 | $anonymous = TRUE; | |
68 | $this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous); | |
6712d671 | 69 | |
05f3c31c DG |
70 | // Now test making a copy of the event |
71 | $this->webtestLogin(); | |
72 | $this->openCiviPage("event/manage", "reset=1&action=copy&id=$eventId"); | |
6712d671 | 73 | $this->_testVerifyEventInfo('Copy of ' . $eventTitle, $eventInfoStrings); |
74 | $this->_testVerifyRegisterPage($registerStrings); | |
6a488035 TO |
75 | } |
76 | ||
77 | function testAddPaidEventDiscount() { | |
6a488035 TO |
78 | |
79 | // Log in using webtestLogin() method | |
80 | $this->webtestLogin(); | |
81 | ||
82 | // We need a payment processor | |
83 | $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); | |
84 | $this->webtestAddPaymentProcessor($processorName); | |
85 | ||
071a6d2e | 86 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
87 | |
88 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
89 | $eventDescription = "Here is a description for this conference."; | |
90 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
91 | ||
92 | $streetAddress = "100 Main Street"; | |
93 | $this->_testAddLocation($streetAddress); | |
94 | ||
95 | $this->_testAddReminder($eventTitle); | |
96 | ||
97 | $this->_testAddFees(TRUE, FALSE, $processorName); | |
98 | ||
99 | // intro text for registration page | |
100 | $registerIntro = "Fill in all the fields below and click Continue."; | |
101 | $multipleRegistrations = TRUE; | |
102 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
103 | ||
76e86fd8 CW |
104 | $discountFees = array("225.00", "300.00"); |
105 | ||
6a488035 TO |
106 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); |
107 | $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); | |
108 | ||
109 | $registerStrings = array_push($discountFees, "Member", "Non-member", $registerIntro); | |
110 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
111 | ||
112 | $numberRegistrations = 3; | |
113 | $anonymous = TRUE; | |
114 | $this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous); | |
115 | } | |
116 | ||
117 | function testDeletePriceSetDiscount() { | |
6a488035 TO |
118 | |
119 | // Log in using webtestLogin() method | |
120 | $this->webtestLogin(); | |
121 | ||
122 | // We need a payment processor | |
123 | $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); | |
124 | $this->webtestAddPaymentProcessor($processorName); | |
125 | ||
071a6d2e | 126 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
127 | |
128 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
129 | $eventDescription = "Here is a description for this conference."; | |
130 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
131 | ||
132 | $streetAddress = "100 Main Street"; | |
133 | $this->_testAddLocation($streetAddress); | |
134 | ||
135 | //Add two discounts | |
136 | $discount = $this->_testAddFees(TRUE, FALSE, $processorName, TRUE); | |
137 | ||
138 | // intro text for registration page | |
139 | $registerIntro = "Fill in all the fields below and click Continue."; | |
140 | $multipleRegistrations = TRUE; | |
141 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
142 | ||
76e86fd8 CW |
143 | $discountFees = array("225.00", "300.00"); |
144 | ||
6a488035 TO |
145 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); |
146 | $id = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); | |
147 | ||
148 | $registerStrings = array_push($discountFees, "Member", "Non-member", $registerIntro); | |
149 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
150 | ||
151 | //Add Price Set now | |
42daf119 | 152 | $this->openCiviPage("event/manage/fee", "reset=1&action=update&id=$id", "_qf_Fee_upload-bottom"); |
6a488035 TO |
153 | $this->click("xpath=//a[@id='quickconfig']"); |
154 | $this->waitForElementPresent('popupContainer'); | |
efb29358 CW |
155 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
156 | // Sleep should never be used for wait for anything to load from the server | |
157 | // Justification for this instance: FIXME | |
6a488035 TO |
158 | sleep(3); |
159 | $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[1]"); | |
efb29358 CW |
160 | // Because it tends to cause problems, all uses of sleep() must be justified in comments |
161 | // Sleep should never be used for wait for anything to load from the server | |
162 | // Justification for this instance: FIXME | |
6a488035 | 163 | sleep(3); |
76e86fd8 | 164 | |
6a488035 | 165 | //Assert quick config change and discount deletion |
071a6d2e | 166 | $this->openCiviPage("admin/price", "reset=1"); |
6a488035 TO |
167 | $this->assertStringsPresent($discount); |
168 | } | |
169 | ||
170 | function testAddDeleteEventDiscount() { | |
6a488035 TO |
171 | |
172 | // Log in using webtestLogin() method | |
173 | $this->webtestLogin(); | |
174 | ||
175 | // We need a payment processor | |
176 | $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); | |
177 | $this->webtestAddPaymentProcessor($processorName); | |
178 | ||
071a6d2e | 179 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
180 | |
181 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
182 | $eventDescription = "Here is a description for this conference."; | |
183 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
184 | ||
185 | $streetAddress = "100 Main Street"; | |
186 | $this->_testAddLocation($streetAddress); | |
187 | ||
188 | //Add two discounts | |
189 | $discount = $this->_testAddFees(TRUE, FALSE, $processorName, TRUE); | |
190 | ||
191 | // intro text for registration page | |
192 | $registerIntro = "Fill in all the fields below and click Continue."; | |
193 | $multipleRegistrations = TRUE; | |
194 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
195 | ||
76e86fd8 CW |
196 | $discountFees = array("225.00", "300.00"); |
197 | ||
6a488035 TO |
198 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); |
199 | $id = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); | |
200 | ||
201 | $registerStrings = array_push($discountFees, "Member", "Non-member", $registerIntro); | |
202 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
203 | //Delete the discount | |
204 | $this->_deleteDiscount($id, $eventTitle, $discount); | |
205 | } | |
206 | ||
207 | function _deleteDiscount($id, $eventTitle, $discount) { | |
42daf119 | 208 | $this->openCiviPage("event/manage/fee", "reset=1&action=update&id=$id", "_qf_Fee_upload-bottom"); |
6a488035 TO |
209 | $this->type("discount_name_2", ""); |
210 | $this->click("xpath=//tr[@id='discount_2']/td[3]/span/a"); | |
211 | $this->click("xpath=//tr[@id='discount_2']/td[4]/span/a"); | |
212 | $this->type("discounted_value_1_2", ""); | |
213 | $this->type("discounted_value_2_2", ""); | |
214 | $this->click("_qf_Fee_upload-bottom"); | |
071a6d2e | 215 | $this->waitForPageToLoad(); |
6a488035 | 216 | //Assertions |
071a6d2e | 217 | $this->openCiviPage("admin/price", "reset=1"); |
6a488035 TO |
218 | $this->assertStringsPresent($discount[1]); |
219 | } | |
220 | ||
221 | function testAddPaidEventWithTemplate() { | |
6a488035 TO |
222 | |
223 | // Log in using webtestLogin() method | |
224 | $this->webtestLogin(); | |
225 | ||
226 | // We need a payment processor | |
227 | $processorName = "Webtest Dummy" . substr(sha1(rand()), 0, 7); | |
228 | $this->webtestAddPaymentProcessor($processorName); | |
229 | ||
071a6d2e | 230 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
231 | |
232 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
233 | $eventDescription = "Here is a description for this conference."; | |
234 | // Select paid online registration template. | |
235 | $templateID = 6; | |
236 | $eventTypeID = 1; | |
237 | $this->_testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID); | |
238 | ||
239 | $streetAddress = "100 Main Street"; | |
240 | $this->_testAddLocation($streetAddress); | |
241 | ||
242 | $this->_testAddFees(FALSE, FALSE, $processorName); | |
243 | ||
244 | // intro text for registration page | |
245 | $registerIntro = "Fill in all the fields below and click Continue."; | |
246 | $this->_testAddOnlineRegistration($registerIntro); | |
247 | ||
248 | // $eventInfoStrings = array( $eventTitle, $eventDescription, $streetAddress ); | |
249 | $eventInfoStrings = array($eventTitle, $streetAddress); | |
250 | $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings); | |
251 | ||
252 | $registerStrings = array("225.00", "Member", "300.00", "Non-member", $registerIntro); | |
253 | $this->_testVerifyRegisterPage($registerStrings); | |
254 | } | |
255 | ||
256 | function testAddFreeEventWithTemplate() { | |
6a488035 TO |
257 | |
258 | // Log in using webtestLogin() method | |
259 | $this->webtestLogin(); | |
42daf119 | 260 | |
071a6d2e | 261 | $this->openCiviPage("event/add", "reset=1&action=add"); |
76e86fd8 | 262 | |
6a488035 TO |
263 | $eventTitle = 'My Free Meeting - ' . substr(sha1(rand()), 0, 7); |
264 | $eventDescription = "Here is a description for this free meeting."; | |
265 | // Select "Free Meeting with Online Registration" template (id = 5). | |
266 | $templateID = 5; | |
76e86fd8 CW |
267 | $eventTypeID = 4; |
268 | ||
6a488035 | 269 | $this->_testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID); |
76e86fd8 CW |
270 | |
271 | $streetAddress = "100 Main Street"; | |
272 | ||
273 | $this->_testAddLocation($streetAddress); | |
6a488035 TO |
274 | |
275 | // Go to Fees tab and check that Paid Event is false (No) | |
276 | $this->click("link=Fees"); | |
277 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
278 | $this->verifyChecked("CIVICRM_QFID_0_is_monetary"); | |
279 | ||
280 | // intro text for registration page | |
281 | $registerIntro = "Fill in all the fields below and click Continue."; | |
282 | $this->_testAddOnlineRegistration($registerIntro); | |
283 | ||
284 | // $eventInfoStrings = array( $eventTitle, $eventDescription, $streetAddress ); | |
285 | $eventInfoStrings = array($eventTitle, $streetAddress); | |
286 | $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings); | |
287 | ||
288 | $registerStrings = array($registerIntro); | |
289 | $this->_testVerifyRegisterPage($registerStrings); | |
290 | // make sure paid_event div is NOT present since this is a free event | |
291 | $this->verifyElementNotPresent("css=div.paid_event-section"); | |
292 | } | |
293 | ||
0dce9149 | 294 | function testUnpaidPaid() { |
0dce9149 PJ |
295 | // Log in using webtestLogin() method |
296 | $this->webtestLogin(); | |
297 | ||
071a6d2e | 298 | $this->openCiviPage("event/add", "reset=1&action=add"); |
0dce9149 PJ |
299 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); |
300 | $eventDescription = "Here is a description for this conference."; | |
301 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
302 | ||
303 | //add fee section with pay later checked | |
304 | $this->_testAddFees(FALSE, FALSE, NULL, FALSE, TRUE); | |
305 | ||
306 | //make the event unpaid | |
307 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
308 | $this->assertChecked('is_pay_later'); | |
309 | $this->click("CIVICRM_QFID_0_is_monetary"); | |
ef72146d | 310 | $this->clickLink("_qf_Fee_upload-bottom", "_qf_Fee_upload-bottom"); |
0dce9149 PJ |
311 | |
312 | //check if pay later option is disabled | |
313 | $this->click('CIVICRM_QFID_1_is_monetary'); | |
0dce9149 PJ |
314 | $this->waitForElementPresent('is_pay_later'); |
315 | $this->assertNotChecked('is_pay_later'); | |
316 | } | |
317 | ||
c4e6d4e8 PJ |
318 | function testAjaxCustomGroupLoad() { |
319 | $this->webtestLogin(); | |
320 | ||
321 | $triggerElement = array('name' => 'event_type_id', 'type' => 'select'); | |
322 | $customSets = array( | |
323 | array('entity' => 'Event', 'subEntity' => 'Conference', 'triggerElement' => $triggerElement), | |
324 | ); | |
325 | ||
326 | $pageUrl = array('url' => 'event/add', 'args' => "reset=1&action=add"); | |
327 | $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl); | |
328 | } | |
329 | ||
6a488035 | 330 | function _testAddEventInfo($eventTitle, $eventDescription) { |
6a488035 TO |
331 | $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); |
332 | ||
6a488035 TO |
333 | $this->select("event_type_id", "value=1"); |
334 | ||
335 | // Attendee role s/b selected now. | |
336 | $this->select("default_role_id", "value=1"); | |
337 | ||
338 | // Enter Event Title, Summary and Description | |
339 | $this->type("title", $eventTitle); | |
340 | $this->type("summary", "This is a great conference. Sign up now!"); | |
341 | ||
342 | // Type description in ckEditor (fieldname, text to type, editor) | |
343 | $this->fillRichTextField("description", $eventDescription, 'CKEditor'); | |
344 | ||
345 | // Choose Start and End dates. | |
346 | // Using helper webtestFillDate function. | |
347 | $this->webtestFillDateTime("start_date", "+1 week"); | |
348 | $this->webtestFillDateTime("end_date", "+1 week 1 day 8 hours "); | |
349 | ||
350 | $this->type("max_participants", "50"); | |
351 | $this->click("is_map"); | |
352 | $this->click("is_public"); | |
353 | $this->click("_qf_EventInfo_upload-bottom"); | |
0dce9149 | 354 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
6a488035 TO |
355 | } |
356 | ||
357 | function _testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID) { | |
6a488035 | 358 | $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); |
42daf119 | 359 | |
6a488035 | 360 | // Select event template. Use option value, not label - since labels can be translated and test would fail |
76e86fd8 | 361 | $this->select("template_id", "value={$templateID}"); |
6a488035 TO |
362 | |
363 | // Wait for event type to be filled in (since page reloads) | |
364 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76e86fd8 | 365 | $this->verifySelectedValue("event_type_id", $eventTypeID); |
6a488035 TO |
366 | |
367 | // Attendee role s/b selected now. | |
368 | $this->verifySelectedValue("default_role_id", "1"); | |
76e86fd8 | 369 | |
6a488035 | 370 | // Enter Event Title, Summary and Description |
76e86fd8 CW |
371 | $this->type("title", $eventTitle); |
372 | ||
6a488035 TO |
373 | $this->type("summary", "This is a great conference. Sign up now!"); |
374 | ||
375 | // Type description in ckEditor (fieldname, text to type, editor) | |
376 | $this->fillRichTextField("description", $eventDescription, 'CKEditor'); | |
377 | ||
378 | // Choose Start and End dates. | |
379 | // Using helper webtestFillDate function. | |
380 | $this->webtestFillDateTime("start_date", "+1 week"); | |
381 | $this->webtestFillDateTime("end_date", "+1 week 1 day 8 hours "); | |
382 | ||
383 | $this->type("max_participants", "50"); | |
384 | $this->click("is_map"); | |
76e86fd8 CW |
385 | $this->click("_qf_EventInfo_upload-bottom"); |
386 | ||
6a488035 TO |
387 | } |
388 | ||
389 | function _testAddLocation($streetAddress) { | |
390 | // Wait for Location tab form to load | |
391 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
392 | $this->waitForElementPresent("_qf_Location_upload-bottom"); | |
393 | ||
394 | // Fill in address fields | |
395 | $streetAddress = "100 Main Street"; | |
396 | $this->type("address_1_street_address", $streetAddress); | |
397 | $this->type("address_1_city", "San Francisco"); | |
398 | $this->type("address_1_postal_code", "94117"); | |
399 | $this->select("address_1_state_province_id", "value=1004"); | |
400 | $this->type("email_1_email", "info@civicrm.org"); | |
401 | ||
402 | $this->click("_qf_Location_upload-bottom"); | |
403 | ||
404 | // Wait for "saved" status msg | |
405 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
406 | $this->waitForTextPresent("'Location' information has been saved."); | |
407 | } | |
408 | ||
0dce9149 | 409 | function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro", $double = FALSE, $payLater = FALSE) { |
6a488035 TO |
410 | $discount1 = "Early-bird" . substr(sha1(rand()), 0, 7); |
411 | $discount2 = ""; | |
412 | // Go to Fees tab | |
413 | $this->click("link=Fees"); | |
414 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
415 | $this->click("CIVICRM_QFID_1_is_monetary"); | |
0dce9149 PJ |
416 | |
417 | if ($payLater) { | |
418 | $this->check('is_pay_later'); | |
8ca3d31e | 419 | $this->fillRichTextField('pay_later_receipt', 'testing later instructions'); |
0dce9149 PJ |
420 | } |
421 | else { | |
422 | $this->uncheck('is_pay_later'); | |
423 | } | |
424 | ||
425 | if ($processorName) { | |
426 | $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); | |
427 | } | |
6a488035 TO |
428 | $this->select("financial_type_id", "value=4"); |
429 | if ($priceSet) { | |
430 | // get one - TBD | |
431 | } | |
432 | else { | |
433 | $this->type("label_1", "Member"); | |
434 | $this->type("value_1", "225.00"); | |
435 | $this->type("label_2", "Non-member"); | |
436 | $this->type("value_2", "300.00"); | |
437 | $this->click("CIVICRM_QFID_1_4"); | |
438 | } | |
439 | ||
440 | if ($discount) { | |
441 | // enter early bird discount fees | |
442 | $this->click("is_discount"); | |
443 | $this->waitForElementPresent("discount_name_1"); | |
444 | $this->type("discount_name_1", $discount1); | |
445 | $this->webtestFillDate("discount_start_date_1", "-3 week"); | |
446 | $this->webtestFillDate("discount_end_date_1", "-2 week"); | |
76e86fd8 CW |
447 | $this->clickLink("_qf_Fee_submit", "discounted_value_1_1"); |
448 | ||
6712d671 | 449 | $this->type("discounted_value_1_1", "225.00"); |
450 | $this->type("discounted_value_2_1", "300.00"); | |
6a488035 TO |
451 | |
452 | if ($double) { | |
453 | $discount2 = "Early-bird" . substr(sha1(rand()), 0, 7); | |
454 | // enter early bird discount fees | |
455 | $this->click("link=another discount set"); | |
456 | $this->waitForElementPresent("discount_name_2"); | |
457 | $this->type("discount_name_2", $discount2); | |
458 | $this->webtestFillDate("discount_start_date_2", "-1 week"); | |
459 | $this->webtestFillDate("discount_end_date_2", "+1 week"); | |
225a8648 | 460 | $this->clickLink("_qf_Fee_submit", "discounted_value_2_1"); |
6712d671 | 461 | $this->type("discounted_value_1_2", "225.00"); |
462 | $this->type("discounted_value_2_2", "300.00"); | |
463 | } | |
6a488035 TO |
464 | $this->click("xpath=//fieldset[@id='discount']/fieldset/table/tbody/tr[2]/td[3]/input"); |
465 | } | |
466 | $this->click("_qf_Fee_upload-bottom"); | |
76e86fd8 | 467 | |
6a488035 TO |
468 | // Wait for "saved" status msg |
469 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6c5f7368 | 470 | $this->waitForText('crm-notification-container', "'Fee' information has been saved"); |
6a488035 TO |
471 | return array($discount1, $discount2); |
472 | } | |
473 | ||
474 | function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) { | |
475 | // Go to Online Registration tab | |
476 | $this->click("link=Online Registration"); | |
477 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); | |
478 | ||
479 | $this->check("is_online_registration"); | |
480 | $this->assertChecked("is_online_registration"); | |
481 | if ($multipleRegistrations) { | |
482 | $this->check("is_multiple_registrations"); | |
483 | $this->assertChecked("is_multiple_registrations"); | |
484 | } | |
485 | ||
486 | $this->fillRichTextField("intro_text", $registerIntro); | |
76e86fd8 | 487 | |
6a488035 TO |
488 | // enable confirmation email |
489 | $this->click("CIVICRM_QFID_1_is_email_confirm"); | |
76e86fd8 CW |
490 | $this->type("confirm_from_name", "Jane Doe"); |
491 | ||
6a488035 TO |
492 | $this->type("confirm_from_email", "jane.doe@example.org"); |
493 | ||
494 | $this->click("_qf_Registration_upload-bottom"); | |
495 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
496 | $this->waitForTextPresent("'Registration' information has been saved."); | |
497 | } | |
498 | ||
499 | function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) { | |
500 | // verify event input on info page | |
501 | // start at Manage Events listing | |
071a6d2e | 502 | $this->openCiviPage("event/manage", "reset=1"); |
6a488035 TO |
503 | $this->click("link=$eventTitle"); |
504 | ||
505 | // Look for Register button | |
506 | $this->waitForElementPresent("link=Register Now"); | |
507 | ||
508 | // Check for correct event info strings | |
509 | $this->assertStringsPresent($eventInfoStrings); | |
76e86fd8 | 510 | |
6a488035 TO |
511 | // Optionally verify event fees (especially for discounts) |
512 | if ($eventFees) { | |
76e86fd8 CW |
513 | $this->assertStringsPresent($eventFees); |
514 | ||
6a488035 | 515 | } |
a471a3b6 | 516 | return $this->urlArg('id'); |
6a488035 TO |
517 | } |
518 | ||
519 | function _testVerifyRegisterPage($registerStrings) { | |
520 | // Go to Register page and check for intro text and fee levels | |
521 | $this->click("link=Register Now"); | |
522 | $this->waitForElementPresent("_qf_Register_upload-bottom"); | |
523 | $this->assertStringsPresent($registerStrings); | |
524 | return $this->getLocation(); | |
525 | } | |
526 | ||
dc91d100 PJ |
527 | function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE, $isPayLater = FALSE, $participantEmailInfo = array(), $paymentProcessor = NULL) { |
528 | $infoPassed = FALSE; | |
529 | if (!empty($participantEmailInfo)) { | |
530 | $infoPassed = TRUE; | |
531 | } | |
6a488035 | 532 | if ($anonymous) { |
42daf119 | 533 | $this->webtestLogout(); |
6a488035 | 534 | } |
4a2859ea | 535 | $primaryParticipantInfo = array(); |
6a488035 | 536 | $this->open($registerUrl); |
dc91d100 PJ |
537 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
538 | ||
6a488035 | 539 | $this->select("additional_participants", "value=" . $numberRegistrations); |
dc91d100 | 540 | |
5480e9b2 | 541 | if ($infoPassed) { |
542 | $primaryParticipantInfo['first_name'] = $participantEmailInfo[0]['first_name']; | |
543 | $primaryParticipantInfo['last_name'] = $participantEmailInfo[0]['last_name']; | |
544 | $primaryParticipantInfo['email'] = $participantEmailInfo[0]['email']; | |
545 | } | |
546 | else { | |
547 | $primaryParticipantInfo['first_name'] = "Jane"; | |
548 | $primaryParticipantInfo['last_name'] = "Smith" . substr(sha1(rand()), 0, 7); | |
549 | $primaryParticipantInfo['email'] = "smith" . substr(sha1(rand()), 0, 7) . "@example.org"; | |
550 | } | |
551 | ||
8ca3d31e | 552 | $this->type("first_name", $primaryParticipantInfo['first_name']); |
553 | $this->type("last_name", $primaryParticipantInfo['last_name']); | |
5480e9b2 | 554 | $this->type("email-Primary", $primaryParticipantInfo['email']); |
8ca3d31e | 555 | |
f9057553 | 556 | if (!$isPayLater) { |
dc91d100 | 557 | if ($paymentProcessor) { |
6712d671 | 558 | $paymentProcessorEle = $this->getAttribute("xpath=//form[@id='Register']//label[contains(text(), '{$paymentProcessor}')]/@for"); |
559 | $this->check($paymentProcessorEle); | |
dc91d100 | 560 | } |
f9057553 PN |
561 | $this->select("credit_card_type", "value=Visa"); |
562 | $this->type("credit_card_number", "4111111111111111"); | |
563 | $this->type("cvv2", "000"); | |
564 | $this->select("credit_card_exp_date[M]", "value=1"); | |
565 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
4a2859ea PJ |
566 | $this->type("billing_first_name", $primaryParticipantInfo['first_name']); |
567 | $this->type("billing_last_name", $primaryParticipantInfo['last_name']); | |
f9057553 PN |
568 | $this->type("billing_street_address-5", "15 Main St."); |
569 | $this->type(" billing_city-5", "San Jose"); | |
570 | $this->select("billing_country_id-5", "value=1228"); | |
571 | $this->select("billing_state_province_id-5", "value=1004"); | |
572 | $this->type("billing_postal_code-5", "94129"); | |
573 | } | |
6a488035 TO |
574 | |
575 | $this->click("_qf_Register_upload-bottom"); | |
576 | ||
577 | if ($numberRegistrations > 1) { | |
578 | for ($i = 1; $i <= $numberRegistrations; $i++) { | |
579 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
580 | // Look for Skip button | |
581 | $this->waitForElementPresent("_qf_Participant_{$i}_next_skip-Array"); | |
8ca3d31e | 582 | |
5480e9b2 | 583 | if ($infoPassed) { |
584 | $this->type("first_name", $participantEmailInfo[$i]['first_name']); | |
585 | $this->type("last_name", $participantEmailInfo[$i]['last_name']); | |
586 | $this->type("email-Primary", $participantEmailInfo[$i]['email']); | |
587 | } | |
588 | else { | |
589 | $this->type("first_name", "Jane Add $i"); | |
590 | $this->type("last_name", "Smith" . substr(sha1(rand()), 0, 7)); | |
591 | $this->type("email-Primary", "smith" . substr(sha1(rand()), 0, 7) . "@example.org"); | |
592 | } | |
8ca3d31e | 593 | |
6a488035 TO |
594 | $this->click("_qf_Participant_{$i}_next"); |
595 | } | |
596 | } | |
597 | ||
598 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
599 | $this->waitForElementPresent("_qf_Confirm_next-bottom"); | |
6712d671 | 600 | $confirmStrings = array("Event Fee(s)"); |
601 | if (!$isPayLater) { | |
602 | $confirmStrings += array("Billing Name and Address", "Credit Card Information"); | |
f9057553 | 603 | } |
6a488035 TO |
604 | $this->assertStringsPresent($confirmStrings); |
605 | $this->click("_qf_Confirm_next-bottom"); | |
606 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6712d671 | 607 | $thankStrings = array("Thank You for Registering", "Event Total"); |
608 | if (!$isPayLater) { | |
f9057553 PN |
609 | $thankStrings = array("Transaction Date"); |
610 | } | |
611 | else { | |
612 | $thankStrings += array("testing later instructions"); | |
613 | } | |
6a488035 | 614 | $this->assertStringsPresent($thankStrings); |
4a2859ea | 615 | return $primaryParticipantInfo; |
6a488035 TO |
616 | } |
617 | ||
618 | function _testAddReminder($eventTitle) { | |
619 | // Go to Schedule Reminders tab | |
620 | $this->click('css=li#tab_reminder a'); | |
621 | $this->waitForElementPresent("_qf_ScheduleReminders_upload-bottom"); | |
622 | $this->type("title", "Event Reminder for " . $eventTitle); | |
623 | $this->select('entity', 'label=Registered'); | |
624 | ||
625 | $this->select('start_action_offset', 'label=1'); | |
626 | $this->select('start_action_condition', 'label=after'); | |
627 | $this->click('is_repeat'); | |
628 | $this->select('repetition_frequency_interval', 'label=2'); | |
629 | $this->select('end_date', 'label=Event End Date'); | |
630 | $this->click('recipient'); | |
631 | $this->select('recipient', 'label=Participant Role'); | |
632 | // $this->select( 'recipient_listing', 'value=1' ); | |
633 | ||
634 | // Fill Subject | |
635 | $subject = 'subject' . substr(sha1(rand()), 0, 4); | |
636 | $this->type('subject', $subject); | |
637 | $this->fillRichTextField("html_message", "This is the test HTML version here!!!", 'CKEditor'); | |
638 | ||
639 | $this->type("text_message", "This is the test text version here!!!"); | |
640 | //click on save | |
641 | $this->click('_qf_ScheduleReminders_upload-bottom'); | |
642 | $this->waitForElementPresent("link=Add Reminder"); | |
643 | ||
644 | $this->waitForElementPresent("link=Edit"); | |
645 | ||
646 | $verifyText = array( | |
647 | 1 => 'Event Reminder for ' . $eventTitle, | |
648 | 3 => '1 hour after Event Start Date', | |
649 | 4 => 'Registered', | |
650 | 5 => 'Yes', | |
651 | 6 => 'Yes', | |
652 | ); | |
653 | ||
654 | //verify the fields for Event Reminder selector | |
655 | foreach ($verifyText as $key => $value) { | |
656 | $this->verifyText("xpath=//table[@class='display']/tbody/tr/td[$key]", $value); | |
657 | } | |
658 | } | |
659 | ||
f9057553 PN |
660 | function testEventAddMultipleParticipant() { |
661 | // Log in using webtestLogin() method | |
4a2859ea | 662 | $this->webtestLogin(); |
f9057553 PN |
663 | $this->openCiviPage("event/add", "reset=1&action=add"); |
664 | ||
665 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
666 | $eventDescription = "Here is a description for this conference."; | |
667 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
668 | $streetAddress = "100 Main Street"; | |
669 | $this->_testAddLocation($streetAddress); | |
670 | ||
dc91d100 | 671 | $this->_testAddFees(FALSE, FALSE, "Test Processor", FALSE, TRUE); |
f9057553 PN |
672 | $registerIntro = "Fill in all the fields below and click Continue."; |
673 | $multipleRegistrations = TRUE; | |
674 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
675 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); | |
dc91d100 | 676 | $eventId = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings); |
f9057553 PN |
677 | |
678 | $registerStrings = array("225.00", "Member", "300.00", "Non-member", $registerIntro); | |
679 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
f9057553 PN |
680 | $numberRegistrations = 3; |
681 | $anonymous = TRUE; | |
dc91d100 PJ |
682 | |
683 | // CRM-12615 add additional participants and check email, amount | |
5480e9b2 | 684 | $primaryParticipant = array( |
685 | 'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org", | |
686 | 'first_name' => "Kate", | |
687 | 'last_name' => "Simth" . substr(sha1(rand()), 0, 7), | |
688 | ); | |
689 | $secParticipant = array( | |
690 | 'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org", | |
691 | 'first_name' => "Kate Add 1", | |
692 | 'last_name' => "Simth" . substr(sha1(rand()), 0, 7), | |
693 | ); | |
694 | $thirdParticipant = array( | |
695 | 'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org", | |
696 | 'first_name' => "Kate Add 2", | |
697 | 'last_name' => "Simth" . substr(sha1(rand()), 0, 7), | |
698 | ); | |
699 | ||
dc91d100 | 700 | $participantEmails = array($primaryParticipant, $secParticipant, $thirdParticipant); |
4a2859ea | 701 | $addtlPart = array($secParticipant, $thirdParticipant); |
5480e9b2 | 702 | $primaryParticipantInfo = |
703 | $this->_testOnlineRegistration($registerUrl, 2, $anonymous, FALSE, $participantEmails, "Test Processor"); | |
4a2859ea | 704 | $primaryDisplayName = "{$primaryParticipantInfo['first_name']} {$primaryParticipantInfo['last_name']}"; |
dc91d100 PJ |
705 | $this->webtestLogin(); |
706 | $this->openCiviPage("event/search?reset=1", "reset=1"); | |
707 | $this->type('event_name', $eventTitle); | |
708 | $this->click("event_name"); | |
709 | $this->waitForElementPresent("css=div.ac_results-inner li"); | |
710 | $this->click("css=div.ac_results-inner li"); | |
711 | $this->clickLink('_qf_Search_refresh'); | |
5480e9b2 | 712 | $this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(), |
713 | '{$secParticipant['last_name']}, {$secParticipant['first_name']}')]/../../td[6]", preg_quote('225.00')); | |
714 | $this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(), | |
715 | '{$thirdParticipant['last_name']}, {$thirdParticipant['first_name']}')]/../../td[6]", preg_quote('225.00')); | |
4a2859ea PJ |
716 | |
717 | //CRM-12618 check edit screen of additional participant and ensuring record_contribution not present | |
718 | foreach ($addtlPart as $value) { | |
5480e9b2 | 719 | $this->clickLink("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(), |
720 | '{$value['last_name']}, {$value['first_name']}')]/../../td[11]/span/a[2][contains(text(), 'Edit')]", | |
721 | '_qf_Participant_upload-bottom'); | |
722 | $this->assertTrue( | |
723 | $this->isElementPresent("xpath=//tr[@class='crm-participant-form-block-registered-by']/td[2]/a[contains(text(), | |
724 | '$primaryDisplayName')]"), 'Registered By info is wrong on additional participant edit form'); | |
4a2859ea | 725 | $this->assertElementContainsText("xpath=//form[@id='Participant']/h3", 'Edit Event Registration'); |
5480e9b2 | 726 | $this->assertTrue( |
727 | $this->isElementPresent( | |
728 | "xpath=//table/tbody/tr[@class='crm-participant-form-block-displayName']/td[2][contains(text(), | |
729 | '{$value['first_name']} {$value['last_name']}')]"), | |
4a2859ea PJ |
730 | 'Wrong Participant edit form' |
731 | ); | |
5480e9b2 | 732 | $this->assertFalse($this->isElementPresent('record_contribution'), |
733 | 'Record Payment checkbox showed up wrongly for additional participant edit screen'); | |
4a2859ea PJ |
734 | $this->clickLink("_qf_Participant_cancel-top"); |
735 | } | |
736 | ||
dc91d100 PJ |
737 | //unselect the payment processor configured |
738 | $this->openCiviPage("event/manage/fee", "reset=1&action=update&id={$eventId}", '_qf_Fee_upload-bottom'); | |
739 | $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='Test Processor']"); | |
740 | $this->clickLink("_qf_Fee_upload-bottom"); | |
741 | ||
f9057553 PN |
742 | // add participant and 3 additional participant and change status of participant from edit participant |
743 | $this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous, TRUE); | |
dc91d100 | 744 | $this->webtestLogin(); |
f9057553 PN |
745 | |
746 | $this->openCiviPage("event/search?reset=1", "reset=1"); | |
747 | $this->type('event_name', $eventTitle); | |
748 | $this->click("event_name"); | |
749 | $this->waitForElementPresent("css=div.ac_results-inner li"); | |
750 | $this->click("css=div.ac_results-inner li"); | |
751 | $this->click("xpath=//td[@class='crm-event-form-block-participant_status']/div[@class='listing-box']//div/label[text()='Pending from pay later']"); | |
752 | $this->click('_qf_Search_refresh'); | |
753 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
754 | $this->click("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[text()='Edit']"); | |
755 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
756 | $this->select('status_id', 'label=Registered'); | |
757 | $this->click('record_contribution'); | |
758 | $this->select('contribution_status_id', 'label=Completed'); | |
759 | $pID = $this->urlArg('id'); | |
760 | $contributionID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $pID, 'contribution_id', 'participant_id'); | |
761 | $this->click('_qf_Participant_upload-top'); | |
762 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
763 | $this->verifyFinancialRecords($contributionID); | |
6712d671 | 764 | |
f9057553 PN |
765 | // add participant and 3 additional participant and change status of participant from edit contribution |
766 | $this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous, TRUE); | |
6712d671 | 767 | $this->webtestLogin(); |
f9057553 | 768 | |
6712d671 | 769 | $this->openCiviPage("event/search?reset=1", "reset=1"); |
770 | $this->type('event_name', $eventTitle); | |
f9057553 PN |
771 | $this->click("event_name"); |
772 | $this->waitForElementPresent("css=div.ac_results-inner li"); | |
773 | $this->click("css=div.ac_results-inner li"); | |
774 | $this->click("xpath=//td[@class='crm-event-form-block-participant_status']/div[@class='listing-box']//div/label[text()='Pending from pay later']"); | |
775 | $this->click('_qf_Search_refresh'); | |
776 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
777 | $this->click("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[text()='View']"); | |
778 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
779 | $pID = $this->urlArg('id'); | |
780 | $contributionID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $pID, 'contribution_id', 'participant_id'); | |
781 | $this->click("xpath=//tr[@id='rowid$contributionID']/td[8]/span//a[text()='Edit']"); | |
782 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
783 | $this->select('contribution_status_id', 'label=Completed'); | |
784 | $this->click('_qf_Contribution_upload-bottom'); | |
785 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
786 | $this->verifyFinancialRecords($contributionID); | |
787 | } | |
788 | ||
789 | function verifyFinancialRecords($contributionID) { | |
790 | // check count for civicrm_contribution and civicrm_financial_item in civicrm_entity_financial_trxn | |
791 | $query = "SELECT COUNT(DISTINCT(c1.id)) civicrm_contribution, COUNT(c2.id) civicrm_financial_item FROM civicrm_entity_financial_trxn c1 | |
792 | LEFT JOIN civicrm_entity_financial_trxn c2 ON c1.financial_trxn_id = c2.financial_trxn_id AND c2.entity_table ='civicrm_financial_item' | |
793 | LEFT JOIN civicrm_financial_item cfi ON cfi.id = c2.entity_id | |
794 | WHERE c1.entity_table = 'civicrm_contribution' AND c1.entity_id = %1 AND cfi.status_id = 1"; | |
795 | $params = array(1 => array($contributionID, 'Integer')); | |
796 | $dao = CRM_Core_DAO::executeQuery($query, $params); | |
797 | $dao->fetch(); | |
798 | $this->assertEquals('2', $dao->civicrm_contribution, 'civicrm_financial_trxn count does not match'); | |
6712d671 | 799 | $this->assertEquals('8', $dao->civicrm_financial_item, 'civicrm_financial_item count does not match'); |
36b1f0cc | 800 | $query = "SELECT COUNT(cft.id) civicrm_financial_trxn FROM civicrm_entity_financial_trxn ceft |
801 | INNER JOIN civicrm_financial_trxn cft ON ceft.financial_trxn_id = cft.id | |
f9057553 PN |
802 | WHERE ceft.entity_id = %1 AND ceft.entity_table = 'civicrm_contribution'"; |
803 | $dao = CRM_Core_DAO::executeQuery($query, $params); | |
804 | $dao->fetch(); | |
805 | $this->assertEquals('2', $dao->civicrm_financial_trxn, 'civicrm_financial_trxn count does not match'); | |
806 | } | |
36b1f0cc | 807 | |
808 | function testEventApprovalRegistration() { | |
809 | $this->webtestLogin(); | |
810 | ||
811 | //Participant Status | |
812 | $this->openCiviPage("admin/participant_status", "reset=1&action=browse"); | |
813 | $this->_testEnableParticipantStatuses('Awaiting approval'); | |
814 | $this->isElementPresent("xpath=//td[@class='crm-particpant-label'][contains(text(), 'Awaiting approval')]/../td[9]/span/a[2][text()='Disable']"); | |
815 | $this->_testEnableParticipantStatuses('Pending from approval'); | |
816 | $this->isElementPresent("xpath=//td[@class='crm-particpant-label'][contains(text(), 'Pending from approval')]/../td[9]/span/a[2][text()='Disable']"); | |
817 | $this->_testEnableParticipantStatuses('Rejected'); | |
818 | $this->isElementPresent("xpath=//td[@class='crm-particpant-label'][contains(text(), 'Rejected')]/../td[9]/span/a[2][text()='Disable']"); | |
819 | ||
820 | //Create New Event | |
821 | ||
822 | $this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom'); | |
823 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
824 | $email = 'Smith' . substr(sha1(rand()), 0, 7) . '@example.com'; | |
825 | $eventDescription = 'Here is a description for this conference.'; | |
826 | $this->select('event_type_id', 'value=1'); | |
827 | ||
828 | // Attendee role s/b selected now. | |
829 | $this->select('default_role_id', 'value=1'); | |
830 | // Enter Event Title, Summary and Description | |
831 | $this->type('title', $eventTitle); | |
832 | $this->type('summary', 'This is a great conference. Sign up now!'); | |
833 | ||
834 | // Type description in ckEditor (fieldname, text to type, editor) | |
835 | $this->fillRichTextField('description', $eventDescription ); | |
836 | $this->type('max_participants', '50'); | |
837 | $this->click('is_map'); | |
838 | $this->click('_qf_EventInfo_upload-bottom'); | |
839 | ||
840 | // Wait for Location tab form to load | |
841 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
842 | ||
843 | // Go to Fees tab | |
844 | $this->click('link=Fees'); | |
845 | $id = $this->urlArg('id'); | |
846 | $this->waitForElementPresent('_qf_Fee_upload-bottom'); | |
847 | $this->click('CIVICRM_QFID_1_is_monetary'); | |
848 | $processorName = 'Test Processor'; | |
849 | $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); | |
850 | $this->select('financial_type_id','label=Event Fee'); | |
851 | $this->type("label[1]",'Junior Stars'); | |
852 | $this->type("value[1]",'500.00'); | |
853 | $this->type("label[2]",'Super Stars'); | |
854 | $this->type("value[2]",'1000.00'); | |
855 | $this->check('default'); | |
856 | $this->click('_qf_Fee_upload-bottom'); | |
857 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
858 | ||
859 | // intro text for registration page | |
860 | $registerIntro = 'Fill in all the fields below and click Continue.'; | |
861 | ||
862 | // Go to Online Registration tab | |
863 | $this->click('link=Online Registration'); | |
864 | $this->waitForElementPresent('_qf_Registration_upload-bottom'); | |
865 | $this->check('is_online_registration'); | |
866 | $this->assertChecked('is_online_registration'); | |
867 | ||
868 | //Requires Approvel | |
869 | $this->check('requires_approval'); | |
870 | $this->assertChecked('requires_approval'); | |
871 | $this->click('_qf_Registration_upload-bottom'); | |
872 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
873 | $this->waitForTextPresent("'Registration' information has been saved."); | |
874 | ||
875 | // verify event input on info page | |
876 | // start at Manage Events listing | |
877 | $this->openCiviPage('event/manage', 'reset=1'); | |
878 | $this->click("link=$eventTitle"); | |
879 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
880 | $firstName = substr(sha1(rand()), 0, 7); | |
881 | $this->webtestAddContact($firstName, 'Anderson', TRUE); | |
882 | $contactName = "Anderson, $firstName"; | |
883 | $displayName = "$firstName Anderson"; | |
884 | $this->openCiviPage("event/register", "reset=1&id=$id", '_qf_Register_upload-bottom'); | |
885 | $this->type('first_name',$firstName); | |
886 | ||
887 | //fill in last name | |
888 | $lastName = 'Recuron'.substr(sha1(rand()), 0, 7); | |
889 | $this->type('last_name', $contactName); | |
890 | $email = $firstName . '@example.com'; | |
891 | $this->type('email-Primary', $email); | |
892 | $this->click('_qf_Register_upload'); | |
893 | $this->waitForElementPresent("_qf_Confirm_next"); | |
894 | $this->click('_qf_Confirm_next'); | |
895 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
896 | $this->waitForElementPresent("xpath=//div[@class='section']"); | |
897 | $this->assertTextPresent("Thank You for Registering"); | |
898 | ||
899 | } | |
900 | ||
901 | function _testEnableParticipantStatuses($status) { | |
902 | // enable participant status | |
903 | if ($this->isElementPresent("xpath=//td[@class='crm-particpant-label'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']")){ | |
904 | $this->click("xpath=//td[@class='crm-particpant-label'][contains(text(), '{$status}')]/../td[9]/span/a[2][text()='Enable']"); | |
905 | $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']"); | |
906 | $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[2]"); | |
907 | } | |
908 | } | |
42daf119 | 909 | } |