Merge pull request #4931 from davecivicrm/INFRA-132
[civicrm-core.git] / tests / phpunit / WebTest / Event / PricesetMaxCountTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
6a488035 5 +--------------------------------------------------------------------+
06a1bc01 6 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25*/
26
6a488035 27require_once 'CiviTest/CiviSeleniumTestCase.php';
e9479dcf
EM
28
29/**
30 * Class WebTest_Event_PricesetMaxCountTest
31 */
6a488035
TO
32class WebTest_Event_PricesetMaxCountTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
00be9182 38 public function testWithoutFieldCount() {
6a488035
TO
39 // Log in using webtestLogin() method
40 $this->webtestLogin();
41
c3ad8633
CW
42 // Use default payment processor
43 $processorName = 'Test Processor';
6a488035
TO
44 $this->webtestAddPaymentProcessor($processorName);
45
46 // create priceset
47 $priceset = 'Price - ' . substr(sha1(rand()), 0, 7);
48 $financialType = 'Donation';
49 $this->_testAddSet($priceset, $financialType);
50
51 // create price fields
52 $fields = array(
c0f4edef 53 'Full Conference' => array(
54 'type' => 'Text',
6a488035
TO
55 'amount' => '525.00',
56 'max_count' => 2,
57 'is_required' => TRUE,
58 'financial_type_id' => 1,
59 ),
60 'Meal Choice' => array(
61 'type' => 'Select',
62 'options' => array(
c0f4edef 63 1 => array(
64 'label' => 'Chicken',
6a488035
TO
65 'amount' => '525.00',
66 'max_count' => 1,
67 'financial_type_id' => 1,
68 ),
69 2 => array(
70 'label' => 'Vegetarian',
71 'amount' => '200.00',
72 'max_count' => 5,
73 'financial_type_id' => 1,
74 ),
75 ),
76 ),
77 'Pre-conference Meetup?' => array(
78 'type' => 'Radio',
79 'options' => array(
c0f4edef 80 1 => array(
81 'label' => 'Yes',
6a488035
TO
82 'amount' => '50.00',
83 'max_count' => 1,
84 'financial_type_id' => 1,
85 ),
86 2 => array(
87 'label' => 'No',
88 'amount' => '10',
89 'max_count' => 5,
90 'financial_type_id' => 1,
91 ),
92 ),
93 ),
94 'Evening Sessions' => array(
95 'type' => 'CheckBox',
96 'options' => array(
c0f4edef 97 1 => array(
98 'label' => 'First Five',
6a488035
TO
99 'amount' => '100.00',
100 'max_count' => 2,
101 'financial_type_id' => 1,
102 ),
103 2 => array(
104 'label' => 'Second Four',
105 'amount' => '50.00',
106 'max_count' => 4,
107 'financial_type_id' => 1,
108 ),
109 ),
110 ),
111 );
112
113 // add price fields
114 $this->_testAddPriceFields($fields);
115
116 // get price set url.
117 $pricesetLoc = $this->getLocation();
118
119 // get text field Id.
3e080337 120 $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
121 $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
122 $textFieldId = $this->urlArg('fid', $textFieldIdURL);
6a488035
TO
123
124 $this->open($pricesetLoc);
125 $this->waitForPageToLoad($this->getTimeoutMsec());
126
127 // get select field id
128 $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
3e080337 129 $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
6a488035 130 $selectFieldLoc = $this->getLocation();
3e080337 131 $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
132 $selectFieldId = $this->urlArg('fid', $selectFieldURL);
6a488035
TO
133
134 // get select field ids
135 // get select field option1
3e080337 136 $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
137 $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
6a488035
TO
138
139 // get select field option2
3e080337 140 $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
141 $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
6a488035
TO
142
143 // create event.
144 $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
145 $paramsEvent = array(
146 'title' => $eventTitle,
147 'template_id' => 6,
148 'event_type_id' => 4,
149 'payment_processor' => $processorName,
150 'price_set' => $priceset,
151 );
152
153 $infoEvent = $this->_testAddEvent($paramsEvent);
154
155 // logout to register for event.
42daf119 156 $this->webtestLogout();
6a488035
TO
157
158 // Register Participant 1
159 // visit event info page
160 $this->open($infoEvent);
161 $this->waitForPageToLoad($this->getTimeoutMsec());
162
163 // register for event
164 $this->click('link=Register Now');
165 $this->waitForElementPresent('_qf_Register_upload-bottom');
166
167 // exceed maximun count for text field, check for form rule
168 $this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
169
170 $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
171
ddc67b94 172 $this->type('first_name', 'Mary');
86bfa4f6 173 $this->type('last_name', 'Jones' . substr(sha1(rand()), 0, 5));
6a488035
TO
174 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
175 $this->type('email-Primary', $email);
176
177 // fill billing related info
178 $this->_fillRegisterWithBillingInfo();
179
180 $this->assertStringsPresent(array('Sorry, currently only 2 seats are available for this option.'));
181
182 // fill correct value for text field
183 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
184
185 $this->click('_qf_Register_upload-bottom');
186 $this->waitForPageToLoad($this->getTimeoutMsec());
187
188 $this->_checkConfirmationAndRegister();
189
190 // Register Participant 2
191 // visit event info page
192 $this->open($infoEvent);
193 $this->waitForPageToLoad($this->getTimeoutMsec());
194
195 $this->click('link=Register Now');
196 $this->waitForElementPresent('_qf_Register_upload-bottom');
197
198 // exceed maximun count for text field, check for form rule
199 $this->type("xpath=//input[@id='price_{$textFieldId}']", '2');
ddc67b94 200 $this->type('first_name', 'Mary');
86bfa4f6 201 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
202 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
203 $this->type('email-Primary', $email);
204
205 // fill billing related info and register
206 $this->_fillRegisterWithBillingInfo();
207
208 $this->assertStringsPresent(array('Sorry, currently only a single seat is available for this option.'));
209
210 // fill correct value for test field
211 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
212
213 // select sold option for select field, check for form rule
214 $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
215 $this->click('_qf_Register_upload-bottom');
216 $this->waitForPageToLoad($this->getTimeoutMsec());
217
218 $this->assertStringsPresent(array('Sorry, this option is currently sold out.'));
219
220 // fill correct available option for select field
221 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
222
fdb227e0 223 $this->click("css=input[data-amount=10]");
6a488035
TO
224 $this->click('_qf_Register_upload-bottom');
225 $this->waitForPageToLoad($this->getTimeoutMsec());
226
227 $this->_checkConfirmationAndRegister();
228 }
229
00be9182 230 public function testWithFieldCount() {
6a488035
TO
231 // Log in using webtestLogin() method
232 $this->webtestLogin();
233
c3ad8633
CW
234 // Use default payment processor
235 $processorName = 'Test Processor';
6a488035
TO
236 $this->webtestAddPaymentProcessor($processorName);
237
238 // create priceset
239 $priceset = 'Price - ' . substr(sha1(rand()), 0, 7);
240 $financialType = 'Donation';
241 $this->_testAddSet($priceset, $financialType);
242
243 // create price fields
244 $fields = array(
c0f4edef 245 'Full Conference' => array(
246 'type' => 'Text',
6a488035
TO
247 'amount' => '525.00',
248 'max_count' => 4,
249 'count' => 2,
250 'is_required' => TRUE,
251 'financial_type_id' => 1,
252 ),
253 'Meal Choice' => array(
254 'type' => 'Select',
255 'options' => array(
c0f4edef 256 1 => array(
257 'label' => 'Chicken',
6a488035
TO
258 'amount' => '525.00',
259 'max_count' => 2,
260 'count' => 2,
261 'financial_type_id' => 1,
262 ),
263 2 => array(
264 'label' => 'Vegetarian',
265 'amount' => '200.00',
266 'max_count' => 10,
267 'count' => 5,
268 'financial_type_id' => 1,
269 ),
270 ),
271 ),
272 'Pre-conference Meetup?' => array(
273 'type' => 'Radio',
274 'options' => array(
c0f4edef 275 1 => array(
276 'label' => 'Yes',
6a488035
TO
277 'amount' => '50.00',
278 'max_count' => 2,
279 'count' => 1,
280 'financial_type_id' => 1,
281 ),
282 2 => array(
283 'label' => 'No',
284 'amount' => '10',
285 'max_count' => 10,
286 'count' => 5,
287 'financial_type_id' => 1,
288 ),
289 ),
290 ),
291 'Evening Sessions' => array(
292 'type' => 'CheckBox',
293 'options' => array(
c0f4edef 294 1 => array(
295 'label' => 'First Five',
6a488035
TO
296 'amount' => '100.00',
297 'max_count' => 4,
298 'count' => 2,
299 'financial_type_id' => 1,
300 ),
301 2 => array(
302 'label' => 'Second Four',
303 'amount' => '50.00',
304 'max_count' => 8,
305 'count' => 4,
306 'financial_type_id' => 1,
307 ),
308 ),
309 ),
310 );
311
312 // add price fields
313 $this->_testAddPriceFields($fields);
314
315 // get price set url.
316 $pricesetLoc = $this->getLocation();
317
318 // get text field Id.
3e080337 319 $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
320 $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
321 $textFieldId = $this->urlArg('fid', $textFieldIdURL);
6a488035
TO
322
323 $this->open($pricesetLoc);
324 $this->waitForPageToLoad($this->getTimeoutMsec());
325
326 // get select field id
327 $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
3e080337 328 $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
6a488035 329 $selectFieldLoc = $this->getLocation();
3e080337 330 $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
331 $selectFieldId = $this->urlArg('fid', $selectFieldURL);
6a488035
TO
332
333 // get select field ids
334 // get select field option1
3e080337 335 $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
336 $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
6a488035
TO
337
338 // get select field option2
3e080337 339 $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
340 $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
6a488035
TO
341
342 // create event.
343 $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
344 $paramsEvent = array(
345 'title' => $eventTitle,
346 'template_id' => 6,
347 'event_type_id' => 4,
348 'payment_processor' => $processorName,
349 'price_set' => $priceset,
350 );
351
352 $infoEvent = $this->_testAddEvent($paramsEvent);
353
354 // logout to register for event.
42daf119 355 $this->webtestLogout();
6a488035
TO
356
357 // Register Participant 1
358 // visit event info page
359 $this->open($infoEvent);
360 $this->waitForPageToLoad($this->getTimeoutMsec());
361
362 // register for event
363 $this->click('link=Register Now');
364 $this->waitForElementPresent('_qf_Register_upload-bottom');
365
366 // check for form rule
367 $this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
368
ddc67b94 369 $this->type('first_name', 'Mary');
86bfa4f6 370 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
371 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
372 $this->type('email-Primary', $email);
373
374 // fill billing related info
375 $this->_fillRegisterWithBillingInfo();
376
377 $this->assertStringsPresent(array('Sorry, currently only 4 seats are available for this option.'));
378
379 $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
380
381 // fill correct value and register
382 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
383
384 $this->click('_qf_Register_upload-bottom');
385 $this->waitForPageToLoad($this->getTimeoutMsec());
386
387 $this->_checkConfirmationAndRegister();
388
389 // Register Participant 2
390 // visit event info page
391 $this->open($infoEvent);
392 $this->waitForPageToLoad($this->getTimeoutMsec());
393
394 $this->click('link=Register Now');
395 $this->waitForElementPresent('_qf_Register_upload-bottom');
396
397 // check for form rule
398 $this->type("xpath=//input[@id='price_{$textFieldId}']", '2');
ddc67b94 399 $this->type('first_name', 'Mary');
86bfa4f6 400 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
401 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
402 $this->type('email-Primary', $email);
403
404 // fill billing related info and register
405 $this->_fillRegisterWithBillingInfo();
406
407 $this->assertStringsPresent(array('Sorry, currently only 2 seats are available for this option.'));
408
409 // fill correct value and register
410 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
411
412 // check for sold option for select field
413 $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
414
415 $this->click('_qf_Register_upload-bottom');
416 $this->waitForPageToLoad($this->getTimeoutMsec());
417
418 $this->assertStringsPresent(array('Sorry, this option is currently sold out.'));
419
420 // check for sold option for select field
421 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
422
423 $this->click('_qf_Register_upload-bottom');
424 $this->waitForPageToLoad($this->getTimeoutMsec());
425
426 $this->_checkConfirmationAndRegister();
427 }
428
00be9182 429 public function testAdditionalParticipantWithoutFieldCount() {
6a488035
TO
430 // Log in using webtestLogin() method
431 $this->webtestLogin();
432
c3ad8633
CW
433 // Use default payment processor
434 $processorName = 'Test Processor';
6a488035
TO
435 $this->webtestAddPaymentProcessor($processorName);
436
437 // create priceset
438 $priceset = 'Price - ' . substr(sha1(rand()), 0, 7);
439 $financialType = 'Donation';
440 $this->_testAddSet($priceset, $financialType);
441
442 // create price fields
443 $fields = array(
c0f4edef 444 'Full Conference' => array(
445 'type' => 'Text',
6a488035
TO
446 'amount' => '525.00',
447 'max_count' => 6,
448 'is_required' => TRUE,
449 'financial_type_id' => 1,
450 ),
451 'Meal Choice' => array(
452 'type' => 'Select',
453 'options' => array(
c0f4edef 454 1 => array(
455 'label' => 'Chicken',
6a488035
TO
456 'amount' => '525.00',
457 'max_count' => 3,
458 'financial_type_id' => 1,
459 ),
460 2 => array(
461 'label' => 'Vegetarian',
462 'amount' => '200.00',
463 'max_count' => 2,
464 'financial_type_id' => 1,
465 ),
466 ),
467 ),
468 'Pre-conference Meetup?' => array(
469 'type' => 'Radio',
470 'options' => array(
c0f4edef 471 1 => array(
472 'label' => 'Yes',
6a488035
TO
473 'amount' => '50.00',
474 'max_count' => 4,
475 'financial_type_id' => 1,
476 ),
477 2 => array(
478 'label' => 'No',
479 'amount' => '10',
480 'max_count' => 5,
481 'financial_type_id' => 1,
482 ),
483 ),
484 ),
485 'Evening Sessions' => array(
486 'type' => 'CheckBox',
487 'options' => array(
c0f4edef 488 1 => array(
489 'label' => 'First Five',
6a488035
TO
490 'amount' => '100.00',
491 'max_count' => 6,
492 'financial_type_id' => 1,
493 ),
494 2 => array(
495 'label' => 'Second Four',
496 'amount' => '50.00',
497 'max_count' => 4,
498 'financial_type_id' => 1,
499 ),
500 ),
501 ),
502 );
503
504 // add price fields
505 $this->_testAddPriceFields($fields);
506
507 // get price set url.
508 $pricesetLoc = $this->getLocation();
509
510 // get text field Id.
3e080337 511 $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
512 $textFieldURL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
513 $textFieldId = $this->urlArg('fid', $textFieldURL);
6a488035
TO
514
515 $this->open($pricesetLoc);
516 $this->waitForPageToLoad($this->getTimeoutMsec());
517
518 // get select field id
519 $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
3e080337 520 $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
6a488035 521 $selectFieldLoc = $this->getLocation();
3e080337 522 $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
523 $selectFieldId = $this->urlArg('fid', $selectFieldURL);
6a488035
TO
524
525 // get select field ids
526 // get select field option1
3e080337 527 $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
528 $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
6a488035
TO
529
530 // get select field option2
3e080337 531 $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']/table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
532 $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
6a488035
TO
533
534 // create event.
535 $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
536 $paramsEvent = array(
537 'title' => $eventTitle,
538 'template_id' => 6,
539 'event_type_id' => 4,
540 'payment_processor' => $processorName,
541 'price_set' => $priceset,
542 'is_multiple_registrations' => TRUE,
543 );
544
545 $infoEvent = $this->_testAddEvent($paramsEvent);
546
547 // logout to register for event.
42daf119 548 $this->webtestLogout();
6a488035
TO
549
550 // 1'st registration
551 // Register Participant 1
552 // visit event info page
553 $this->open($infoEvent);
554 $this->waitForPageToLoad($this->getTimeoutMsec());
555
556 // register for event
557 $this->click('link=Register Now');
558 $this->waitForElementPresent('_qf_Register_upload-bottom');
559
560 // select 3 participants ( including current )
561 $this->select('additional_participants', 'value=2');
562
563 // Check for Participant1
564 // exceed maximun count for text field, check for form rule
565 $this->type("xpath=//input[@id='price_{$textFieldId}']", '7');
566
ddc67b94 567 $this->type('first_name', 'Mary');
86bfa4f6 568 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
569 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
570 $this->type('email-Primary', $email);
571
572 // fill billing related info
573 $this->_fillRegisterWithBillingInfo();
574
575 $this->assertStringsPresent(array('Sorry, currently only 6 seats are available for this option.'));
576
577 // fill correct value for text field
578 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
579 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
580
581 $this->click('_qf_Register_upload-bottom');
582 $this->waitForPageToLoad($this->getTimeoutMsec());
583
584 // Check for Participant2
585 // exceed maximun count for text field, check for form rule
586 $this->type("xpath=//input[@id='price_{$textFieldId}']", '6');
587
ddc67b94 588 $this->type('first_name', 'Mary Add 2');
86bfa4f6 589 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
590 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
591 $this->type('email-Primary', $email);
592
593 $this->click('_qf_Participant_1_next-Array');
594 $this->waitForPageToLoad($this->getTimeoutMsec());
595
596 $this->assertStringsPresent(array('Sorry, currently only 6 seats are available for this option.'));
597
598 // fill correct value for text field
599 $this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
600 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
601
602 $this->click('_qf_Participant_1_next-Array');
603 $this->waitForPageToLoad($this->getTimeoutMsec());
604
605 // Check for Participant3, check and skip
606 // exceed maximun count for text field, check for form rule
607 $this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
608
ddc67b94 609 $this->type('first_name', 'Mary Add 2');
86bfa4f6 610 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
611 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
612 $this->type('email-Primary', $email);
613
614 $this->click('_qf_Participant_2_next-Array');
615 $this->waitForPageToLoad($this->getTimeoutMsec());
616
617 $this->assertStringsPresent(array('Sorry, currently only 6 seats are available for this option.'));
618
619 // fill correct value for text field
620 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
621
622 // check for select
623 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
624
625 $this->click('_qf_Participant_2_next-Array');
626 $this->waitForPageToLoad($this->getTimeoutMsec());
627
628 $this->assertStringsPresent(array('Sorry, currently only 2 seats are available for this option.'));
629
630 // Skip participant3 and register
631 $this->click('_qf_Participant_2_next_skip-Array');
632 $this->waitForPageToLoad($this->getTimeoutMsec());
633
634 $this->_checkConfirmationAndRegister();
635
6a488035
TO
636 // 2'st registration
637 // Register Participant 1
638 // visit event info page
639 $this->open($infoEvent);
640 $this->waitForPageToLoad($this->getTimeoutMsec());
641
642 // register for event
643 $this->click('link=Register Now');
644 $this->waitForElementPresent('_qf_Register_upload-bottom');
645
646 // select 2 participants ( including current )
647 $this->select('additional_participants', 'value=1');
648
649 // Check for Participant1
650 // exceed maximun count for text field, check for form rule
651 $this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
652
ddc67b94 653 $this->type('first_name', 'Mary');
86bfa4f6 654 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
655 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
656 $this->type('email-Primary', $email);
657
658 // fill billing related info
659 $this->_fillRegisterWithBillingInfo();
660
661 $this->assertStringsPresent(array('Sorry, currently only 2 seats are available for this option.'));
662
663 // fill correct value for text field
664 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
665
666 // check for select field
667 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
668
669 $this->click('_qf_Register_upload-bottom');
670 $this->waitForPageToLoad($this->getTimeoutMsec());
671
672 $this->assertStringsPresent(array('Sorry, this option is currently sold out.'));
673
674 // fill available value for select
675 $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
676
677 $this->click('_qf_Register_upload-bottom');
678 $this->waitForPageToLoad($this->getTimeoutMsec());
679
680 // Check for Participant2
681 // exceed maximun count for text field, check for form rule
682 $this->type("xpath=//input[@id='price_{$textFieldId}']", '2');
683
ddc67b94 684 $this->type('first_name', 'Mary Add 1');
86bfa4f6 685 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
686 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
687 $this->type('email-Primary', $email);
688
689 $this->click('_qf_Participant_1_next-Array');
690 $this->waitForPageToLoad($this->getTimeoutMsec());
691
692 $this->assertStringsPresent(array('Sorry, currently only 2 seats are available for this option.'));
693
694 // fill correct value for text field
695 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
696
697 // check for select field
698 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
699
700 $this->click('_qf_Participant_1_next-Array');
701 $this->waitForPageToLoad($this->getTimeoutMsec());
702
703 $this->assertStringsPresent(array('Sorry, this option is currently sold out.'));
704
705 // fill available value for select
706 $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
707
708 $this->click('_qf_Participant_1_next-Array');
709 $this->waitForPageToLoad($this->getTimeoutMsec());
710
711 $this->_checkConfirmationAndRegister();
712 }
713
00be9182 714 public function testAdditionalParticipantWithFieldCount() {
6a488035
TO
715 // Log in using webtestLogin() method
716 $this->webtestLogin();
717
c3ad8633
CW
718 // Use default payment processor
719 $processorName = 'Test Processor';
6a488035
TO
720 $this->webtestAddPaymentProcessor($processorName);
721
722 // create priceset
723 $priceset = 'Price - ' . substr(sha1(rand()), 0, 7);
724 $financialType = 'Donation';
725 $this->_testAddSet($priceset, $financialType);
726
727 // create price fields
728 $fields = array(
c0f4edef 729 'Full Conference' => array(
730 'type' => 'Text',
6a488035
TO
731 'amount' => '525.00',
732 'count' => 2,
733 'max_count' => 12,
734 'is_required' => TRUE,
735 'financial_type_id' => 1,
736 ),
737 'Meal Choice' => array(
738 'type' => 'Select',
739 'options' => array(
c0f4edef 740 1 => array(
741 'label' => 'Chicken',
6a488035
TO
742 'amount' => '525.00',
743 'count' => 1,
744 'max_count' => 3,
745 'financial_type_id' => 1,
746 ),
747 2 => array(
748 'label' => 'Vegetarian',
749 'amount' => '200.00',
750 'count' => 2,
751 'max_count' => 4,
752 'financial_type_id' => 1,
753 ),
754 ),
755 ),
756 'Pre-conference Meetup?' => array(
757 'type' => 'Radio',
758 'options' => array(
c0f4edef 759 1 => array(
760 'label' => 'Yes',
6a488035
TO
761 'amount' => '50.00',
762 'count' => 2,
763 'max_count' => 8,
764 'financial_type_id' => 1,
765 ),
766 2 => array(
767 'label' => 'No',
768 'amount' => '10',
769 'count' => 5,
770 'max_count' => 25,
771 'financial_type_id' => 1,
772 ),
773 ),
774 ),
775 'Evening Sessions' => array(
776 'type' => 'CheckBox',
777 'options' => array(
c0f4edef 778 1 => array(
779 'label' => 'First Five',
6a488035
TO
780 'amount' => '100.00',
781 'count' => 2,
782 'max_count' => 16,
783 'financial_type_id' => 1,
784 ),
785 2 => array(
786 'label' => 'Second Four',
787 'amount' => '50.00',
788 'count' => 1,
789 'max_count' => 4,
790 'financial_type_id' => 1,
791 ),
792 ),
793 ),
794 );
795
796 // add price fields
797 $this->_testAddPriceFields($fields);
798
799 // get price set url.
800 $pricesetLoc = $this->getLocation();
801
802 // get text field Id.
3e080337 803 $this->waitForElementPresent("xpath=//div[@id='crm-main-content-wrapper']/div/a[1]");
804 $textFieldIdURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[9]/span[1]/a[2]@href");
805 $textFieldId = $this->urlArg('fid', $textFieldIdURL);
6a488035
TO
806
807 $this->open($pricesetLoc);
808 $this->waitForPageToLoad($this->getTimeoutMsec());
809
810 // get select field id
811 $this->click("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[8]/a");
3e080337 812 $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']/button[2]/span[2]");
6a488035 813 $selectFieldLoc = $this->getLocation();
3e080337 814 $selectFieldURL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[9]/span[1]/a[2]@href");
815 $selectFieldId = $this->urlArg('fid', $selectFieldURL);
6a488035
TO
816
817 // get select field ids
818 // get select field option1
3e080337 819 $selectFieldOp1URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[1]/td[7]/span[1]/a[1]@href");
820 $selectFieldOp1 = $this->urlArg('oid', $selectFieldOp1URL);
6a488035
TO
821
822 // get select field option2
3e080337 823 $selectFieldOp2URL = $this->getAttribute("xpath=//div[@id='field_page']//table/tbody/tr[2]/td[7]/span[1]/a[1]@href");
824 $selectFieldOp2 = $this->urlArg('oid', $selectFieldOp2URL);
6a488035
TO
825
826 // create event.
827 $eventTitle = 'Meeting - ' . substr(sha1(rand()), 0, 7);
828 $paramsEvent = array(
829 'title' => $eventTitle,
830 'template_id' => 6,
831 'event_type_id' => 4,
832 'payment_processor' => $processorName,
833 'price_set' => $priceset,
834 'is_multiple_registrations' => TRUE,
835 );
836
837 $infoEvent = $this->_testAddEvent($paramsEvent);
838
839 // logout to register for event.
42daf119 840 $this->webtestLogout();
6a488035
TO
841
842 // 1'st registration
843 // Register Participant 1
844 // visit event info page
845 $this->open($infoEvent);
846 $this->waitForPageToLoad($this->getTimeoutMsec());
847
848 // register for event
849 $this->click('link=Register Now');
850 $this->waitForElementPresent('_qf_Register_upload-bottom');
851
852 // select 3 participants ( including current )
853 $this->select('additional_participants', 'value=2');
854
855 // Check for Participant1
856 // exceed maximun count for text field, check for form rule
857 $this->type("xpath=//input[@id='price_{$textFieldId}']", '7');
858
ddc67b94 859 $this->type('first_name', 'Mary');
86bfa4f6 860 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
861 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
862 $this->type('email-Primary', $email);
863
864 // fill billing related info
865 $this->_fillRegisterWithBillingInfo();
866
867 $this->assertStringsPresent(array('Sorry, currently only 12 seats are available for this option.'));
868
869 // fill correct value for text field
870 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
871 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
872
873 $this->click('_qf_Register_upload-bottom');
874 $this->waitForPageToLoad($this->getTimeoutMsec());
875
876 // Check for Participant2
877 // exceed maximun count for text field, check for form rule
878 $this->type("xpath=//input[@id='price_{$textFieldId}']", '6');
879
ddc67b94 880 $this->type('first_name', 'Mary Add 1');
86bfa4f6 881 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
882 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
883 $this->type('email-Primary', $email);
884
885 $this->click('_qf_Participant_1_next-Array');
886 $this->waitForPageToLoad($this->getTimeoutMsec());
887
888 $this->assertStringsPresent(array('Sorry, currently only 12 seats are available for this option.'));
889
890 // fill correct value for text field
891 $this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
892 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
893
894 $this->click('_qf_Participant_1_next-Array');
895 $this->waitForPageToLoad($this->getTimeoutMsec());
896
897 // Check for Participant3, check and skip
898 // exceed maximun count for text field, check for form rule
899 $this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
900
ddc67b94 901 $this->type('first_name', 'Mary Add 2');
86bfa4f6 902 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
903 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
904 $this->type('email-Primary', $email);
905
906 $this->click('_qf_Participant_2_next-Array');
907 $this->waitForPageToLoad($this->getTimeoutMsec());
908
909 $this->assertStringsPresent(array('Sorry, currently only 12 seats are available for this option.'));
910
911 // fill correct value for text field
912 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
913
914 // check for select
915 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
916
917 $this->click('_qf_Participant_2_next-Array');
918 $this->waitForPageToLoad($this->getTimeoutMsec());
919
fdb227e0 920 $this->assertStringsPresent(array('Sorry, this option is currently sold out.'));
6a488035
TO
921
922 // Skip participant3 and register
923 $this->click('_qf_Participant_2_next_skip-Array');
924 $this->waitForPageToLoad($this->getTimeoutMsec());
925
926 $this->_checkConfirmationAndRegister();
927
6a488035
TO
928 // 2'st registration
929 // Register Participant 1
930 // visit event info page
931 $this->open($infoEvent);
932 $this->waitForPageToLoad($this->getTimeoutMsec());
933
934 // register for event
935 $this->click('link=Register Now');
936 $this->waitForElementPresent('_qf_Register_upload-bottom');
937
938 // select 2 participants ( including current )
939 $this->select('additional_participants', 'value=1');
940
941 // Check for Participant1
942 // exceed maximun count for text field, check for form rule
943 $this->type("xpath=//input[@id='price_{$textFieldId}']", '3');
944
ddc67b94 945 $this->type('first_name', 'Mary');
86bfa4f6 946 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
947 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
948 $this->type('email-Primary', $email);
949
950 // fill billing related info
951 $this->_fillRegisterWithBillingInfo();
952
953 $this->assertStringsPresent(array('Sorry, currently only 4 seats are available for this option.'));
954
955 // fill correct value for text field
956 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
957
958 // check for select field
959 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
960
961 $this->click('_qf_Register_upload-bottom');
962 $this->waitForPageToLoad($this->getTimeoutMsec());
963
964 $this->assertStringsPresent(array('Sorry, this option is currently sold out.'));
965
966 // fill available value for select
967 $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
968
969 $this->click('_qf_Register_upload-bottom');
970 $this->waitForPageToLoad($this->getTimeoutMsec());
971
972 // Check for Participant2
973 // exceed maximun count for text field, check for form rule
974 $this->type("xpath=//input[@id='price_{$textFieldId}']", '2');
975
ddc67b94 976 $this->type('first_name', 'Mary Add 1');
86bfa4f6 977 $this->type('last_name', 'Jane' . substr(sha1(rand()), 0, 5));
6a488035
TO
978 $email = 'jane_' . substr(sha1(rand()), 0, 5) . '@example.org';
979 $this->type('email-Primary', $email);
980
981 $this->click('_qf_Participant_1_next-Array');
982 $this->waitForPageToLoad($this->getTimeoutMsec());
983
984 $this->assertStringsPresent(array('Sorry, currently only 4 seats are available for this option.'));
985
986 // fill correct value for text field
987 $this->type("xpath=//input[@id='price_{$textFieldId}']", '1');
988
989 // check for select field
990 $this->select("price_{$selectFieldId}", "value={$selectFieldOp2}");
991
992 $this->click('_qf_Participant_1_next-Array');
993 $this->waitForPageToLoad($this->getTimeoutMsec());
994
995 $this->assertStringsPresent(array('Sorry, this option is currently sold out.'));
996
997 // fill available value for select
998 $this->select("price_{$selectFieldId}", "value={$selectFieldOp1}");
999
1000 $this->click('_qf_Participant_1_next-Array');
1001 $this->waitForPageToLoad($this->getTimeoutMsec());
1002
1003 $this->_checkConfirmationAndRegister();
1004 }
1005
4cbe18b8
EM
1006 /**
1007 * @param $setTitle
1008 * @param null $financialType
1009 */
00be9182 1010 public function _testAddSet($setTitle, $financialType = NULL) {
42daf119 1011 $this->openCiviPage('admin/price', 'reset=1&action=add', '_qf_Set_next-bottom');
6a488035
TO
1012
1013 // Enter Priceset fields (Title, Used For ...)
1014 $this->type('title', $setTitle);
1015 $this->check('extends_1');
1016
1017 if ($financialType) {
8ada7e8e 1018 $this->select("css=select.crm-form-select", "label={$financialType}");
6a488035
TO
1019 }
1020
1021 $this->click("xpath=//form[@id='Set']/div[3]/table/tbody/tr[4]/td[2]/select");
1022 $this->type('help_pre', 'This is test priceset.');
1023
1024 $this->assertChecked('is_active', 'Verify that Is Active checkbox is set.');
7df6dc24 1025 $this->clickLink('_qf_Set_next-bottom');
6a488035
TO
1026 }
1027
4cbe18b8
EM
1028 /**
1029 * @param $fields
1030 */
00be9182 1031 public function _testAddPriceFields($fields) {
6a488035
TO
1032 $fieldCount = count($fields);
1033 $count = 1;
22cef1b4 1034 $this->waitForElementPresent('label');
6a488035 1035 foreach ($fields as $label => $field) {
08f17a9f 1036 $this->waitForElementPresent('label');
6a488035
TO
1037 $this->type('label', $label);
1038 $this->select('html_type', "value={$field['type']}");
1039
1040 if ($field['type'] == 'Text') {
1041 $this->type('price', $field['amount']);
1042
1043 if (isset($field['count'])) {
1044 $this->waitForElementPresent('count');
1045 $this->type('count', $field['count']);
1046 }
1047
1048 if (isset($field['count'])) {
1049 $this->waitForElementPresent('count');
1050 $this->type('count', $field['count']);
1051 }
1052
1053 if (isset($field['max_count'])) {
1054 $this->waitForElementPresent('max_value');
1055 $this->type('max_value', $field['max_count']);
1056 }
1057
1058 if (isset($field['financial_type_id'])) {
1059 $this->waitForElementPresent('financial_type_id');
1060 $this->select('financial_type_id', "value={$field['financial_type_id']}");
76e86fd8
CW
1061 }
1062
6a488035
TO
1063 }
1064 else {
1065 $this->_testAddMultipleChoiceOptions($field['options'], $field['type']);
1066 }
1067
1068 if (isset($field['is_required']) && $field['is_required']) {
1069 $this->check('is_required');
1070 }
1071
1072 if ($count < $fieldCount) {
1073 $this->click('_qf_Field_next_new-bottom');
1074 }
1075 else {
1076 $this->click('_qf_Field_next-bottom');
1077 }
9bdd2fbd 1078 $this->waitForAjaxContent();
22cef1b4 1079 $this->waitForText('crm-notification-container', "Price Field '$label' has been saved.");
6a488035
TO
1080
1081 $count++;
1082 }
1083 }
1084
4cbe18b8
EM
1085 /**
1086 * @param $options
1087 * @param $fieldType
1088 */
00be9182 1089 public function _testAddMultipleChoiceOptions($options, $fieldType) {
6a488035
TO
1090 foreach ($options as $oIndex => $oValue) {
1091 $this->type("option_label_{$oIndex}", $oValue['label']);
1092 $this->type("option_amount_{$oIndex}", $oValue['amount']);
1093
1094 if (isset($oValue['count'])) {
1095 $this->waitForElementPresent("option_count_{$oIndex}");
1096 $this->type("option_count_{$oIndex}", $oValue['count']);
1097 }
1098
1099 if (isset($oValue['max_count'])) {
1100 $this->waitForElementPresent("option_max_value_{$oIndex}");
1101 $this->type("option_max_value_{$oIndex}", $oValue['max_count']);
1102 }
76e86fd8 1103
6a488035 1104 if (!empty($oValue['financial_type_id'])) {
c0f4edef 1105 $this->select("option_financial_type_id_{$oIndex}", "value={$oValue['financial_type_id']}");
6a488035 1106 }
76e86fd8 1107
6a488035
TO
1108 $this->click('link=another choice');
1109 }
1110
1111 // select first element as default
1112 if ($fieldType == 'CheckBox') {
1113 $this->click('default_checkbox_option[1]');
1114 }
1115 else {
1116 $this->click('CIVICRM_QFID_1_2');
1117 }
1118 }
1119
4cbe18b8 1120 /**
c490a46a 1121 * @param array $params
4cbe18b8
EM
1122 *
1123 * @return string
1124 */
00be9182 1125 public function _testAddEvent($params) {
42daf119 1126 $this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom');
6a488035 1127
6a488035
TO
1128 $this->select('event_type_id', "value={$params['event_type_id']}");
1129
1130 // Attendee role s/b selected now.
1131 $this->select('default_role_id', 'value=1');
1132
1133 // Enter Event Title, Summary and Description
1134 $this->type('title', $params['title']);
1135 $this->type('summary', 'This is a great conference. Sign up now!');
1136 $this->fillRichTextField('description', 'Here is a description for this event.', 'CKEditor');
1137
1138 // Choose Start and End dates.
1139 // Using helper webtestFillDate function.
1140 $this->webtestFillDateTime('start_date', '+1 week');
1141 $this->webtestFillDateTime('end_date', '+1 week 1 day 8 hours ');
1142
1143 $this->type('max_participants', '50');
1144 $this->click('is_map');
1145 $this->click('_qf_EventInfo_upload-bottom');
1146
1147 // Wait for Location tab form to load
1148 $this->waitForPageToLoad($this->getTimeoutMsec());
1149
1150 // Go to Fees tab
1151 $this->click('link=Fees');
1152 $this->waitForElementPresent('_qf_Fee_upload-bottom');
1153 $this->click('xpath=//form[@id="Fee"]/div[2]/table/tbody/tr[2]/td[2]/label[contains(text(), "Yes")]');
1154 $processorName = $params['payment_processor'];
1155 $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']");
1156 $this->select('financial_type_id', 'value=4');
76e86fd8 1157
6a488035
TO
1158 if (array_key_exists('price_set', $params)) {
1159 $this->select('price_set_id', 'label=' . $params['price_set']);
1160 }
1161 if (array_key_exists('fee_level', $params)) {
1162 $counter = 1;
1163 foreach ($params['fee_level'] as $label => $amount) {
1164 $this->type("label_{$counter}", $label);
1165 $this->type("value_{$counter}", $amount);
1166 $counter++;
1167 }
1168 }
1169
8ada7e8e 1170 $this->clickLink('_qf_Fee_upload-bottom', 'link=Online Registration', FALSE);
6a488035
TO
1171
1172 // Go to Online Registration tab
1173 $this->click('link=Online Registration');
1174 $this->waitForElementPresent('_qf_Registration_upload-bottom');
1175
1176 $this->check('is_online_registration');
1177 $this->assertChecked('is_online_registration');
1178
1179 if (isset($params['is_multiple_registrations']) && $params['is_multiple_registrations']) {
1180 $this->click('is_multiple_registrations');
1181 }
1182
60709d21 1183 $this->click('intro_text-plain');
6a488035
TO
1184 $this->fillRichTextField('intro_text', 'Fill in all the fields below and click Continue.');
1185
1186 // enable confirmation email
1187 $this->click('CIVICRM_QFID_1_is_email_confirm');
1188 $this->type('confirm_from_name', 'Jane Doe');
1189 $this->type('confirm_from_email', 'jane.doe@example.org');
1190
1191 $this->click('_qf_Registration_upload-bottom');
8ada7e8e 1192 $this->waitForTextPresent("'Fees' information has been saved.");
6a488035
TO
1193
1194 // verify event input on info page
1195 // start at Manage Events listing
42daf119 1196 $this->openCiviPage('event/manage', 'reset=1');
6a488035
TO
1197 $this->click('link=' . $params['title']);
1198
1199 $this->waitForPageToLoad($this->getTimeoutMsec());
1200 return $this->getLocation();
1201 }
1202
00be9182 1203 public function _fillRegisterWithBillingInfo() {
6a488035
TO
1204 $this->waitForElementPresent('credit_card_type');
1205 $this->select('credit_card_type', 'value=Visa');
1206 $this->type('credit_card_number', '4111111111111111');
1207 $this->type('cvv2', '000');
1208 $this->select('credit_card_exp_date[M]', 'value=1');
1209 $this->select('credit_card_exp_date[Y]', 'value=2020');
1210 $this->type('billing_first_name', 'Jane_' . substr(sha1(rand()), 0, 5));
1211 $this->type('billing_last_name', 'San_' . substr(sha1(rand()), 0, 5));
1212 $this->type('billing_street_address-5', '15 Main St.');
1213 $this->type(' billing_city-5', 'San Jose');
1214 $this->select('billing_country_id-5', 'value=1228');
1215 $this->select('billing_state_province_id-5', 'value=1004');
1216 $this->type('billing_postal_code-5', '94129');
1217
1218 $this->click('_qf_Register_upload-bottom');
1219 $this->waitForPageToLoad($this->getTimeoutMsec());
1220 }
1221
00be9182 1222 public function _checkConfirmationAndRegister() {
6a488035
TO
1223 $confirmStrings = array('Event Fee(s)', 'Billing Name and Address', 'Credit Card Information');
1224 $this->assertStringsPresent($confirmStrings);
fdb227e0 1225 $this->waitForElementPresent("_qf_Confirm_next-bottom");
6a488035
TO
1226 $this->click('_qf_Confirm_next-bottom');
1227 $this->waitForPageToLoad($this->getTimeoutMsec());
1228 $thankStrings = array('Thank You for Registering', 'Event Total', 'Transaction Date');
1229 $this->assertStringsPresent($thankStrings);
1230 }
1231}