Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License along with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
d25dd0ee | 25 | */ |
6a488035 | 26 | |
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Event_MultipleEventRegistrationbyCartTest | |
31 | */ | |
6a488035 | 32 | class WebTest_Event_MultipleEventRegistrationbyCartTest extends CiviSeleniumTestCase { |
76e86fd8 | 33 | |
6a488035 TO |
34 | protected function setUp() { |
35 | parent::setUp(); | |
36 | } | |
76e86fd8 | 37 | |
546b78fa | 38 | /** |
eceb18cc | 39 | * this functionality is broken hence skipping the test. |
546b78fa | 40 | */ |
00be9182 | 41 | public function skiptestAuthenticatedMultipleEvent() { |
76e86fd8 | 42 | |
6a488035 TO |
43 | // Log in using webtestLogin() method |
44 | $this->webtestLogin(); | |
76e86fd8 | 45 | |
6a488035 | 46 | //Enable shopping cart style |
071a6d2e | 47 | $this->openCiviPage("admin/setting/preferences/event", "reset=1"); |
6a488035 TO |
48 | $this->check("enable_cart"); |
49 | $this->click("_qf_Event_next-top"); | |
50 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76e86fd8 | 51 | |
c3ad8633 CW |
52 | // Use default payment processor |
53 | $processorName = 'Test Processor'; | |
6a488035 | 54 | $this->webtestAddPaymentProcessor($processorName); |
76e86fd8 | 55 | |
6a488035 | 56 | //event 1 |
42daf119 | 57 | |
071a6d2e | 58 | $this->openCiviPage("event/add", "reset=1&action=add"); |
76e86fd8 | 59 | |
6a488035 TO |
60 | $eventTitle1 = 'My Conference1 - ' . substr(sha1(rand()), 0, 7); |
61 | $eventDescription1 = "Here is a description for this conference 1."; | |
62 | $this->_testAddEventInfo($eventTitle1, $eventDescription1); | |
76e86fd8 | 63 | |
6a488035 TO |
64 | $streetAddress1 = "100 Main Street"; |
65 | $this->_testAddLocation($streetAddress1); | |
76e86fd8 | 66 | |
6a488035 | 67 | $this->_testAddFees(FALSE, FALSE, $processorName); |
76e86fd8 | 68 | |
6a488035 TO |
69 | // intro text for registration page |
70 | $registerIntro = "Fill in all the fields below and click Continue."; | |
71 | $multipleRegistrations = TRUE; | |
72 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
76e86fd8 | 73 | |
6a488035 TO |
74 | $eventInfoStrings1 = array($eventTitle1, $eventDescription1, $streetAddress1); |
75 | $this->_AddEventToCart($eventTitle1, $eventInfoStrings1); | |
76e86fd8 | 76 | |
6a488035 | 77 | //event 2 |
42daf119 | 78 | |
071a6d2e | 79 | $this->openCiviPage("event/add", "reset=1&action=add"); |
76e86fd8 | 80 | |
6a488035 TO |
81 | $eventTitle2 = 'My Conference2 - ' . substr(sha1(rand()), 0, 7); |
82 | $eventDescription2 = "Here is a description for this conference 2."; | |
83 | $this->_testAddEventInfo($eventTitle2, $eventDescription2); | |
76e86fd8 | 84 | |
6a488035 TO |
85 | $streetAddress2 = "101 Main Street"; |
86 | $this->_testAddLocation($streetAddress2); | |
76e86fd8 | 87 | |
6a488035 | 88 | $this->_testAddFees(FALSE, FALSE, $processorName); |
76e86fd8 | 89 | |
6a488035 TO |
90 | // intro text for registration page |
91 | $registerIntro = "Fill in all the fields below and click Continue."; | |
92 | $multipleRegistrations = TRUE; | |
93 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
76e86fd8 | 94 | |
6a488035 TO |
95 | $eventInfoStrings2 = array($eventTitle2, $eventDescription2, $streetAddress2); |
96 | $this->_AddEventToCart($eventTitle2, $eventInfoStrings2); | |
76e86fd8 | 97 | |
6a488035 | 98 | //event 3 |
42daf119 | 99 | |
071a6d2e | 100 | $this->openCiviPage("event/add", "reset=1&action=add"); |
76e86fd8 | 101 | |
6a488035 TO |
102 | $eventTitle3 = 'My Conference3 - ' . substr(sha1(rand()), 0, 7); |
103 | $eventDescription3 = "Here is a description for this conference 3."; | |
104 | $this->_testAddEventInfo($eventTitle3, $eventDescription3); | |
76e86fd8 | 105 | |
6a488035 TO |
106 | $streetAddress3 = "102 Main Street"; |
107 | $this->_testAddLocation($streetAddress3); | |
76e86fd8 | 108 | |
6a488035 | 109 | $this->_testAddFees(FALSE, FALSE, $processorName); |
76e86fd8 | 110 | |
6a488035 TO |
111 | // intro text for registration page |
112 | $registerIntro = "Fill in all the fields below and click Continue."; | |
113 | $multipleRegistrations = TRUE; | |
114 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
76e86fd8 | 115 | |
6a488035 TO |
116 | $eventInfoStrings3 = array($eventTitle3, $eventDescription3, $streetAddress3); |
117 | $this->_AddEventToCart($eventTitle3, $eventInfoStrings3); | |
76e86fd8 | 118 | |
6a488035 TO |
119 | //Checkout |
120 | $value = $this->_testCheckOut(); | |
76e86fd8 | 121 | |
6a488035 | 122 | //three event names |
f0a9a781 | 123 | $events = array( |
124 | 1 => $eventTitle1, | |
125 | 2 => $eventTitle2, | |
126 | 3 => $eventTitle3, | |
127 | ); | |
76e86fd8 CW |
128 | //check the existence of the contacts who were registered and the one who did the contribution |
129 | ||
f0a9a781 | 130 | $this->_checkContributionsandEventRegistration($value[0], $value[1], $events); |
6a488035 | 131 | } |
76e86fd8 | 132 | |
546b78fa | 133 | /** |
eceb18cc | 134 | * this functionality is broken hence skipping the test. |
546b78fa | 135 | */ |
00be9182 | 136 | public function skiptestAnonymousMultipleEvent() { |
f0a9a781 | 137 | // This is the path where our testing install resides. |
6a488035 TO |
138 | // The rest of URL is defined in CiviSeleniumTestCase base class, in |
139 | // class attributes. | |
76e86fd8 | 140 | |
6a488035 TO |
141 | // Log in using webtestLogin() method |
142 | $this->webtestLogin(); | |
76e86fd8 | 143 | |
c3ad8633 CW |
144 | // Use default payment processor |
145 | $processorName = 'Test Processor'; | |
6a488035 | 146 | $this->webtestAddPaymentProcessor($processorName); |
76e86fd8 | 147 | |
6a488035 | 148 | //event 1 |
42daf119 | 149 | |
071a6d2e | 150 | $this->openCiviPage("event/add", "reset=1&action=add"); |
76e86fd8 | 151 | |
6a488035 TO |
152 | $eventTitle1 = 'My Conference1 - ' . substr(sha1(rand()), 0, 7); |
153 | $eventDescription1 = "Here is a description for this conference 1."; | |
154 | $this->_testAddEventInfo($eventTitle1, $eventDescription1); | |
76e86fd8 | 155 | |
6a488035 TO |
156 | $streetAddress1 = "100 Main Street"; |
157 | $this->_testAddLocation($streetAddress1); | |
76e86fd8 | 158 | |
6a488035 | 159 | $this->_testAddFees(FALSE, FALSE, $processorName); |
76e86fd8 | 160 | |
6a488035 TO |
161 | // intro text for registration page |
162 | $registerIntro = "Fill in all the fields below and click Continue."; | |
163 | $multipleRegistrations = TRUE; | |
164 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
76e86fd8 | 165 | |
6a488035 TO |
166 | $eventInfoStrings1 = array($eventTitle1, $eventDescription1, $streetAddress1); |
167 | $registerUrl1 = $this->_testVerifyEventInfo($eventTitle1, $eventInfoStrings1); | |
168 | ||
169 | //event 2 | |
42daf119 | 170 | |
071a6d2e | 171 | $this->openCiviPage("event/add", "reset=1&action=add"); |
76e86fd8 | 172 | |
6a488035 TO |
173 | $eventTitle2 = 'My Conference2 - ' . substr(sha1(rand()), 0, 7); |
174 | $eventDescription2 = "Here is a description for this conference 2."; | |
175 | $this->_testAddEventInfo($eventTitle2, $eventDescription2); | |
76e86fd8 | 176 | |
6a488035 TO |
177 | $streetAddress2 = "101 Main Street"; |
178 | $this->_testAddLocation($streetAddress2); | |
76e86fd8 | 179 | |
6a488035 | 180 | $this->_testAddFees(FALSE, FALSE, $processorName); |
76e86fd8 | 181 | |
6a488035 TO |
182 | // intro text for registration page |
183 | $registerIntro = "Fill in all the fields below and click Continue."; | |
184 | $multipleRegistrations = TRUE; | |
185 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
76e86fd8 | 186 | |
6a488035 TO |
187 | $eventInfoStrings2 = array($eventTitle2, $eventDescription2, $streetAddress2); |
188 | $registerUrl2 = $this->_testVerifyEventInfo($eventTitle2, $eventInfoStrings2); | |
189 | ||
190 | //event 3 | |
42daf119 | 191 | |
071a6d2e | 192 | $this->openCiviPage("event/add", "reset=1&action=add"); |
76e86fd8 | 193 | |
6a488035 TO |
194 | $eventTitle3 = 'My Conference3 - ' . substr(sha1(rand()), 0, 7); |
195 | $eventDescription3 = "Here is a description for this conference 3."; | |
196 | $this->_testAddEventInfo($eventTitle3, $eventDescription3); | |
76e86fd8 | 197 | |
6a488035 TO |
198 | $streetAddress3 = "102 Main Street"; |
199 | $this->_testAddLocation($streetAddress3); | |
76e86fd8 | 200 | |
6a488035 | 201 | $this->_testAddFees(FALSE, FALSE, $processorName); |
76e86fd8 | 202 | |
6a488035 TO |
203 | // intro text for registration page |
204 | $registerIntro = "Fill in all the fields below and click Continue."; | |
205 | $multipleRegistrations = TRUE; | |
206 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
76e86fd8 | 207 | |
6a488035 TO |
208 | $eventInfoStrings3 = array($eventTitle3, $eventDescription3, $streetAddress3); |
209 | $registerUrl3 = $this->_testVerifyEventInfo($eventTitle3, $eventInfoStrings3); | |
210 | ||
211 | //Enable shopping cart style | |
071a6d2e | 212 | $this->openCiviPage("admin/setting/preferences/event", "reset=1"); |
6a488035 TO |
213 | $this->check("enable_cart"); |
214 | $this->click("_qf_Event_next-top"); | |
215 | ||
216 | $numberRegistrations = 1; | |
217 | $anonymous = TRUE; | |
218 | $this->_testOnlineRegistration($registerUrl1, $numberRegistrations, $anonymous); | |
219 | $this->_testOnlineRegistration($registerUrl2, $numberRegistrations, $anonymous); | |
220 | $this->_testOnlineRegistration($registerUrl3, $numberRegistrations, $anonymous); | |
221 | //Checkout | |
222 | $value = $this->_testCheckOut(); | |
223 | // Log in using webtestLogin() method | |
224 | $this->webtestLogin(); | |
225 | ||
071a6d2e CW |
226 | $this->openCiviPage("dashboard", "reset=1"); |
227 | ||
6a488035 | 228 | //three event names |
f0a9a781 | 229 | $events = array( |
230 | 1 => $eventTitle1, | |
231 | 2 => $eventTitle2, | |
232 | 3 => $eventTitle3, | |
233 | ); | |
76e86fd8 CW |
234 | //check the existence of the contacts who were registered and the one who did the contribution |
235 | ||
f0a9a781 | 236 | $this->_checkContributionsandEventRegistration($value[0], $value[1], $events); |
6a488035 | 237 | } |
76e86fd8 | 238 | |
4cbe18b8 EM |
239 | /** |
240 | * @param $eventTitle | |
241 | * @param $eventDescription | |
242 | */ | |
00be9182 | 243 | public function _testAddEventInfo($eventTitle, $eventDescription) { |
6a488035 TO |
244 | $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); |
245 | ||
6a488035 TO |
246 | $this->select("event_type_id", "value=1"); |
247 | ||
248 | // Attendee role s/b selected now. | |
249 | $this->select("default_role_id", "value=1"); | |
250 | ||
251 | // Enter Event Title, Summary and Description | |
252 | $this->type("title", $eventTitle); | |
253 | $this->type("summary", "This is a great conference. Sign up now!"); | |
254 | ||
255 | // Type description in ckEditor (fieldname, text to type, editor) | |
256 | $this->fillRichTextField("description", $eventDescription, 'CKEditor'); | |
257 | ||
258 | // Choose Start and End dates. | |
259 | // Using helper webtestFillDate function. | |
260 | $this->webtestFillDateTime("start_date", "+1 week"); | |
261 | $this->webtestFillDateTime("end_date", "+1 week 1 day 8 hours "); | |
262 | ||
263 | $this->type("max_participants", "50"); | |
264 | $this->click("is_map"); | |
265 | $this->click("_qf_EventInfo_upload-bottom"); | |
266 | } | |
267 | ||
4cbe18b8 EM |
268 | /** |
269 | * @param $streetAddress | |
270 | */ | |
00be9182 | 271 | public function _testAddLocation($streetAddress) { |
6a488035 TO |
272 | // Wait for Location tab form to load |
273 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
274 | $this->waitForElementPresent("_qf_Location_upload-bottom"); | |
76e86fd8 | 275 | |
6a488035 TO |
276 | $this->type("address_1_street_address", $streetAddress); |
277 | $this->type("address_1_city", "San Francisco"); | |
278 | $this->type("address_1_postal_code", "94117"); | |
279 | $this->select("address_1_state_province_id", "value=1004"); | |
280 | $this->type("email_1_email", "info@civicrm.org"); | |
281 | ||
282 | $this->click("_qf_Location_upload-bottom"); | |
283 | ||
284 | // Wait for "saved" status msg | |
285 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
286 | $this->waitForTextPresent("'Location' information has been saved."); | |
287 | } | |
288 | ||
4cbe18b8 EM |
289 | /** |
290 | * @param bool $discount | |
291 | * @param bool $priceSet | |
292 | * @param string $processorName | |
293 | */ | |
00be9182 | 294 | public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") { |
6a488035 TO |
295 | // Go to Fees tab |
296 | $this->click("link=Fees"); | |
297 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
298 | $this->click("CIVICRM_QFID_1_is_monetary"); | |
299 | $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); | |
f0a9a781 | 300 | $this->select('financial_type_id', 'Event Fee'); |
6a488035 TO |
301 | if ($priceSet) { |
302 | // get one - TBD | |
303 | } | |
304 | else { | |
305 | $this->type("label_1", "Member"); | |
306 | $this->type("value_1", "250.00"); | |
307 | $this->type("label_2", "Non-member"); | |
308 | $this->type("value_2", "325.00"); | |
309 | $this->click("CIVICRM_QFID_2_6"); | |
310 | } | |
311 | ||
312 | if ($discount) { | |
313 | // enter early bird discount fees | |
314 | $this->click("is_discount"); | |
315 | $this->waitForElementPresent("discount_name_1"); | |
316 | $this->type("discount_name_1", "Early-bird" . substr(sha1(rand()), 0, 7)); | |
317 | $this->webtestFillDate("discount_start_date_1", "-1 week"); | |
318 | $this->webtestFillDate("discount_end_date_1", "+2 week"); | |
225a8648 | 319 | $this->clickLink("_qf_Fee_submit", "discounted_value_2_1"); |
f0a9a781 | 320 | $this->type("discounted_value_1_1", "225.00"); |
321 | $this->type("discounted_value_2_1", "300.00"); | |
6a488035 TO |
322 | $this->click("xpath=//fieldset[@id='discount']/fieldset/table/tbody/tr[2]/td[3]/input"); |
323 | } | |
324 | ||
325 | $this->click("_qf_Fee_upload-bottom"); | |
326 | ||
327 | // Wait for "saved" status msg | |
328 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
329 | $this->waitForTextPresent("'Fee' information has been saved."); | |
330 | } | |
331 | ||
4cbe18b8 EM |
332 | /** |
333 | * @param $registerIntro | |
334 | * @param bool $multipleRegistrations | |
335 | */ | |
00be9182 | 336 | public function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) { |
6a488035 TO |
337 | // Go to Online Registration tab |
338 | $this->click("link=Online Registration"); | |
339 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); | |
340 | ||
341 | $this->check("is_online_registration"); | |
342 | $this->assertChecked("is_online_registration"); | |
343 | if ($multipleRegistrations) { | |
344 | $this->check("is_multiple_registrations"); | |
345 | $this->assertChecked("is_multiple_registrations"); | |
346 | } | |
347 | ||
348 | $this->fillRichTextField("intro_text", $registerIntro); | |
349 | ||
350 | // enable confirmation email | |
351 | $this->click("CIVICRM_QFID_1_is_email_confirm"); | |
352 | $this->type("confirm_from_name", "Jane Doe"); | |
353 | $this->type("confirm_from_email", "jane.doe@example.org"); | |
354 | ||
355 | $this->click("_qf_Registration_upload-bottom"); | |
356 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
357 | $this->waitForTextPresent("'Registration' information has been saved."); | |
358 | } | |
359 | ||
4cbe18b8 EM |
360 | /** |
361 | * @param $eventTitle | |
362 | * @param $eventInfoStrings | |
363 | * @param null $eventFees | |
364 | */ | |
00be9182 | 365 | public function _AddEventToCart($eventTitle, $eventInfoStrings, $eventFees = NULL) { |
6a488035 TO |
366 | // verify event input on info page |
367 | // start at Manage Events listing | |
071a6d2e | 368 | $this->openCiviPage("event/manage", "reset=1"); |
225a8648 | 369 | $this->clickLink("link=$eventTitle", "link=Add to Cart"); |
6a488035 TO |
370 | $this->click("link=Add to Cart"); |
371 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
372 | $this->assertTrue($this->isTextPresent("$eventTitle has been added to your cart")); | |
373 | } | |
76e86fd8 | 374 | |
4cbe18b8 EM |
375 | /** |
376 | * @param $eventTitle | |
377 | * @param $eventInfoStrings | |
378 | * @param null $eventFees | |
379 | * | |
380 | * @return string | |
381 | */ | |
00be9182 | 382 | public function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) { |
6a488035 TO |
383 | // verify event input on info page |
384 | // start at Manage Events listing | |
071a6d2e | 385 | $this->openCiviPage("event/manage", "reset=1"); |
6a488035 TO |
386 | $this->click("link=$eventTitle"); |
387 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76e86fd8 | 388 | |
6a488035 TO |
389 | // Check for correct event info strings |
390 | $this->assertStringsPresent($eventInfoStrings); | |
76e86fd8 | 391 | |
6a488035 TO |
392 | // Optionally verify event fees (especially for discounts) |
393 | if ($eventFees) { | |
76e86fd8 CW |
394 | $this->assertStringsPresent($eventFees); |
395 | ||
6a488035 TO |
396 | } |
397 | return $this->getLocation(); | |
398 | } | |
42daf119 | 399 | |
4cbe18b8 EM |
400 | /** |
401 | * @param $registerUrl | |
402 | * @param int $numberRegistrations | |
403 | * @param bool $anonymous | |
404 | */ | |
00be9182 | 405 | public function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE) { |
6a488035 | 406 | if ($anonymous) { |
42daf119 | 407 | $this->webtestLogout(); |
6a488035 TO |
408 | } |
409 | $this->open($registerUrl); | |
410 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
411 | $this->waitForElementPresent("link=Add to Cart"); | |
412 | $this->click("link=Add to Cart"); | |
42daf119 | 413 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
6a488035 | 414 | } |
42daf119 | 415 | |
4cbe18b8 EM |
416 | /** |
417 | * @return array | |
418 | */ | |
00be9182 | 419 | public function _testCheckOut() { |
6a488035 TO |
420 | //View the Cart |
421 | $this->click("xpath=//div[@id='messages']/div/div/a[text()='View your cart.']"); | |
76e86fd8 | 422 | |
6a488035 TO |
423 | //Click on Checkout |
424 | $this->waitForElementPresent("xpath=//a[@class='button crm-check-out-button']/span"); | |
425 | $this->click("xpath=//a[@class='button crm-check-out-button']/span"); | |
426 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76e86fd8 | 427 | |
f0a9a781 | 428 | $firstName = "AB" . substr(sha1(rand()), 0, 7); |
429 | $lastName = "XY" . substr(sha1(rand()), 0, 7); | |
430 | for ($i = 1; $i <= 3; $i++) { | |
431 | $this->type("xpath=//form[@id='ParticipantsAndPrices']/fieldset[$i]/div/fieldset/div/div/fieldset/div/div[2]/input", "{$firstName}.{$lastName}@home.com"); | |
432 | $this->type("xpath=//form[@id='ParticipantsAndPrices']/fieldset[$i]/div/fieldset/div/div[2]/div[2]/input", "{$firstName}.{$lastName}@example.com"); | |
6a488035 TO |
433 | $this->click("xpath=//form[@id='ParticipantsAndPrices']/fieldset[$i]/div[2]/div[2]/input[2]"); |
434 | } | |
435 | $this->click("_qf_ParticipantsAndPrices_upload-bottom"); | |
436 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
437 | $this->select("credit_card_type", "value=Visa"); | |
438 | $this->type("credit_card_number", "4111111111111111"); | |
439 | $this->type("cvv2", "000"); | |
440 | $this->select("credit_card_exp_date[M]", "value=1"); | |
441 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
442 | $this->type("billing_first_name", $firstName); | |
443 | $this->type("billing_last_name", $lastName); | |
444 | $this->type("billing_street_address-5", "15 Main St."); | |
445 | $this->type(" billing_city-5", "San Jose"); | |
446 | $this->select("billing_country_id-5", "value=1228"); | |
447 | $this->select("billing_state_province_id-5", "value=1004"); | |
448 | $this->type("billing_postal_code-5", "94129"); | |
449 | $this->type("billing_contact_email", "{$firstName}.{$lastName}@example.com"); | |
76e86fd8 | 450 | |
6a488035 TO |
451 | $this->click("_qf_Payment_next-bottom"); |
452 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76e86fd8 | 453 | |
6a488035 | 454 | $this->assertTrue($this->isTextPresent("This is your receipt of payment made for the following event registration.")); |
42daf119 | 455 | return array($firstName, $lastName); |
6a488035 TO |
456 | } |
457 | ||
4cbe18b8 | 458 | /** |
100fef9d CW |
459 | * @param string $firstName |
460 | * @param string $lastName | |
4cbe18b8 EM |
461 | * @param $events |
462 | */ | |
00be9182 | 463 | public function _checkContributionsandEventRegistration($firstName, $lastName, $events) { |
6a488035 TO |
464 | //Type the registered participant's email in autocomplete. |
465 | $this->click('sort_name_navigation'); | |
f0a9a781 | 466 | $this->type('css=input#sort_name_navigation', "{$firstName}.{$lastName}@home.com"); |
6a488035 | 467 | $this->typeKeys('css=input#sort_name_navigation', "{$firstName}.{$lastName}@home.com"); |
76e86fd8 | 468 | |
6a488035 TO |
469 | // Wait for result list. |
470 | $this->waitForElementPresent("css=div.ac_results-inner li"); | |
76e86fd8 | 471 | |
6a488035 TO |
472 | // Visit contact summary page. |
473 | $this->click("css=div.ac_results-inner li"); | |
474 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76e86fd8 | 475 | |
6a488035 TO |
476 | //click on Events Tab |
477 | $this->click("xpath=//li[@id='tab_participant']/a"); | |
478 | //check if the participant is registered for all the three events | |
f0a9a781 | 479 | foreach ($events as $key => $value) { |
6a488035 TO |
480 | $this->waitForElementPresent("link=$value"); |
481 | $this->assertTrue($this->isElementPresent("link=$value")); | |
482 | } | |
f0a9a781 | 483 | for ($i = 1; $i <= 3; $i++) { |
6a488035 TO |
484 | $this->waitForElementPresent("xpath=//table[@class='selector']/tbody/tr[$i]/td[6][text()='Registered']"); |
485 | $this->assertTrue($this->isElementPresent("xpath=//table[@class='selector']/tbody/tr[$i]/td[6][text()='Registered']")); | |
486 | } | |
76e86fd8 | 487 | |
6a488035 TO |
488 | //Type the billing email in autocomplete. |
489 | $this->click('sort_name_navigation'); | |
f0a9a781 | 490 | $this->type('css=input#sort_name_navigation', "{$firstName}.{$lastName}@example.com"); |
6a488035 | 491 | $this->typeKeys('css=input#sort_name_navigation', "{$firstName}.{$lastName}@example.com"); |
76e86fd8 | 492 | |
6a488035 TO |
493 | // Wait for result list. |
494 | $this->waitForElementPresent("css=div.ac_results-inner li"); | |
76e86fd8 | 495 | |
6a488035 TO |
496 | // Visit contact summary page. |
497 | $this->click("css=div.ac_results-inner li"); | |
498 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
76e86fd8 | 499 | |
6a488035 TO |
500 | //click on Contributions Tab |
501 | $this->click("xpath=//li[@id='tab_contribute']/a"); | |
502 | //check for the three contributions | |
f0a9a781 | 503 | foreach ($events as $key => $value) { |
6a488035 TO |
504 | $this->waitForElementPresent("xpath=//table[@class='selector']/tbody/tr/td[3][contains(text(),'$value')]"); |
505 | $this->assertTrue($this->isElementPresent("xpath=//table[@class='selector']/tbody/tr/td[3][contains(text(),'$value')]")); | |
506 | } | |
76e86fd8 | 507 | |
6a488035 | 508 | //Disable shopping cart style |
071a6d2e | 509 | $this->openCiviPage("admin/setting/preferences/event", "reset=1"); |
6a488035 TO |
510 | $this->click("enable_cart"); |
511 | $this->click("_qf_Event_next-top"); | |
512 | } | |
96025800 | 513 | |
42daf119 | 514 | } |