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