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