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 | ||
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; | |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Event_PCPAddTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Event_PCPAddTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
38 | function testPCPAdd() { | |
6a488035 TO |
39 | //give permissions to anonymous user |
40 | $permission = array('edit-1-profile-listings-and-forms', 'edit-1-access-all-custom-data', 'edit-1-register-for-events', 'edit-1-make-online-contributions'); | |
41 | $this->changePermissions($permission); | |
42 | ||
42daf119 CW |
43 | // Log in as normal user |
44 | $this->webtestLogin(); | |
45 | ||
6a488035 TO |
46 | // set domain values |
47 | $domainNameValue = 'civicrm organization '; | |
42daf119 CW |
48 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); |
49 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
50 | $middleName = 'Mid' . substr(sha1(rand()), 0, 7); | |
51 | $email = substr(sha1(rand()), 0, 7) . '@example.org'; | |
52 | $this->openCiviPage("admin/domain", "action=update&reset=1", '_qf_Domain_cancel-bottom'); | |
6a488035 TO |
53 | $this->type('name', $domainNameValue); |
54 | $this->type('email_name', $firstName); | |
55 | $this->type('email_address', $email); | |
56 | ||
57 | $this->click('_qf_Domain_next_view-bottom'); | |
58 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
59 | ||
60 | // a random 7-char string and an even number to make this pass unique | |
61 | $conHash = substr(sha1(rand()), 0, 7); | |
62 | $conRand = $contributionAmount = 1000; | |
63 | $contributionPageTitle = 'Contribution page for pcp' . $conHash; | |
64 | $conProcessorType = 'Dummy'; | |
65 | $conAmountSection = TRUE; | |
66 | $conPayLater = TRUE; | |
67 | $conOnBehalf = FALSE; | |
68 | $conPledges = FALSE; | |
69 | $conRecurring = FALSE; | |
70 | $conMemberships = FALSE; | |
71 | $conMemPriceSetId = NULL; | |
72 | $conFriend = FALSE; | |
73 | $conProfilePreId = NULL; | |
74 | $conProfilePostId = NULL; | |
75 | $conPremiums = FALSE; | |
76 | $conWidget = FALSE; | |
77 | $conPcp = FALSE; | |
78 | $conIsAprovalNeeded = TRUE; | |
79 | ||
c3ad8633 CW |
80 | // Use default payment processor |
81 | $processorName = 'Test Processor'; | |
6a488035 TO |
82 | |
83 | //create contribution page for event pcp with campaign type as contribution | |
84 | $contributionPageId = $this->webtestAddContributionPage($conHash, | |
85 | $conRand, | |
86 | $contributionPageTitle, | |
87 | array($processorName => $conProcessorType), | |
88 | $conAmountSection, | |
89 | $conPayLater, | |
90 | $conOnBehalf, | |
91 | $conPledges, | |
92 | $conRecurring, | |
93 | $conMemberships, | |
94 | $conMemPriceSetId, | |
95 | $conFriend, | |
96 | $conProfilePreId, | |
97 | $conProfilePostId, | |
98 | $conPremiums, | |
99 | $conWidget, | |
100 | $conPcp, | |
101 | TRUE, | |
102 | $conIsAprovalNeeded | |
103 | ); | |
104 | ||
105 | //event add for contribute campaign type | |
106 | $campaignType = 'contribute'; | |
107 | $this->_testAddEventForPCP($processorName, $campaignType, $contributionPageId, $firstName, $lastName, $middleName, $email); | |
108 | ||
109 | //event add for contribute campaign type | |
110 | $campaignType = 'event'; | |
42daf119 CW |
111 | $firstName = 'Pa' . substr(sha1(rand()), 0, 4); |
112 | $lastName = 'Cn' . substr(sha1(rand()), 0, 7); | |
113 | $middleName = 'PCid' . substr(sha1(rand()), 0, 7); | |
114 | $email = substr(sha1(rand()), 0, 7) . '@example.org'; | |
6a488035 TO |
115 | $this->_testAddEventForPCP($processorName, $campaignType, NULL, $firstName, $lastName, $middleName, $email); |
116 | } | |
117 | ||
4cbe18b8 EM |
118 | /** |
119 | * @param $processorName | |
120 | * @param $campaignType | |
121 | * @param null $contributionPageId | |
122 | * @param $firstName | |
123 | * @param $lastName | |
124 | * @param $middleName | |
125 | * @param $email | |
126 | */ | |
6a488035 | 127 | function _testAddEventForPCP($processorName, $campaignType, $contributionPageId = NULL, $firstName, $lastName, $middleName, $email) { |
42daf119 | 128 | |
071a6d2e | 129 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
130 | |
131 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
132 | $eventDescription = "Here is a description for this conference."; | |
133 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
134 | ||
135 | $streetAddress = "100 Main Street"; | |
136 | $this->_testAddLocation($streetAddress); | |
137 | ||
138 | $this->_testAddFees(FALSE, FALSE, $processorName); | |
139 | ||
140 | // intro text for registration page | |
141 | $registerIntro = "Fill in all the fields below and click Continue."; | |
142 | $multipleRegistrations = TRUE; | |
143 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
144 | ||
145 | $pageId = $this->_testEventPcpAdd($campaignType, $contributionPageId); | |
146 | $this->_testOnlineRegistration($eventTitle, $pageId, $firstName, $lastName, $middleName, $email, '', $campaignType, TRUE); | |
147 | } | |
148 | ||
4cbe18b8 EM |
149 | /** |
150 | * @param $eventTitle | |
151 | * @param $eventDescription | |
152 | */ | |
6a488035 | 153 | function _testAddEventInfo($eventTitle, $eventDescription) { |
6a488035 TO |
154 | $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); |
155 | ||
6a488035 TO |
156 | $this->select("event_type_id", "value=1"); |
157 | ||
158 | // Attendee role s/b selected now. | |
159 | $this->select("default_role_id", "value=1"); | |
160 | ||
161 | // Enter Event Title, Summary and Description | |
162 | $this->type("title", $eventTitle); | |
163 | $this->type("summary", "This is a great conference. Sign up now!"); | |
164 | ||
165 | // Type description in ckEditor (fieldname, text to type, editor) | |
166 | $this->fillRichTextField("description", $eventDescription, 'CKEditor'); | |
167 | ||
168 | // Choose Start and End dates. | |
169 | // Using helper webtestFillDate function. | |
170 | $this->webtestFillDateTime("start_date", "+1 week"); | |
171 | $this->webtestFillDateTime("end_date", "+1 week 1 day 8 hours "); | |
172 | ||
173 | $this->type("max_participants", "50"); | |
174 | $this->click("is_map"); | |
175 | $this->click("_qf_EventInfo_upload-bottom"); | |
176 | } | |
177 | ||
4cbe18b8 EM |
178 | /** |
179 | * @param $streetAddress | |
180 | */ | |
6a488035 TO |
181 | function _testAddLocation($streetAddress) { |
182 | // Wait for Location tab form to load | |
183 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
184 | $this->waitForElementPresent("_qf_Location_upload-bottom"); | |
185 | ||
186 | // Fill in address fields | |
187 | $streetAddress = "100 Main Street"; | |
188 | $this->type("address_1_street_address", $streetAddress); | |
189 | $this->type("address_1_city", "San Francisco"); | |
190 | $this->type("address_1_postal_code", "94117"); | |
191 | $this->select("address_1_state_province_id", "value=1004"); | |
192 | $this->type("email_1_email", "info@civicrm.org"); | |
193 | ||
194 | $this->click("_qf_Location_upload-bottom"); | |
195 | ||
196 | // Wait for "saved" status msg | |
ed174dea | 197 | $this->waitForElementPresent("_qf_Location_upload-bottom"); |
198 | $this->waitForTextPresent("'Event Location' information has been saved."); | |
6a488035 TO |
199 | } |
200 | ||
4cbe18b8 EM |
201 | /** |
202 | * @param bool $discount | |
203 | * @param bool $priceSet | |
204 | * @param string $processorName | |
205 | */ | |
6a488035 TO |
206 | function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro") { |
207 | // Go to Fees tab | |
208 | $this->click("link=Fees"); | |
209 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
210 | $this->click("CIVICRM_QFID_1_is_monetary"); | |
211 | $this->click("xpath=//tr[@class='crm-event-manage-fee-form-block-payment_processor']/td[2]/label[text()='$processorName']"); | |
212 | if ($priceSet) { | |
213 | // get one - TBD | |
214 | } | |
215 | else { | |
216 | $this->select("financial_type_id", "label=Donation"); | |
217 | $this->type("label_1", "Member"); | |
218 | $this->type("value_1", "250.00"); | |
219 | $this->type("label_2", "Non-member"); | |
220 | $this->type("value_2", "325.00"); | |
221 | //set default | |
222 | $this->click("xpath=//table[@id='map-field-table']/tbody/tr[2]/td[3]/input"); | |
223 | } | |
224 | ||
225 | if ($discount) { | |
226 | // enter early bird discounts TBD | |
227 | } | |
228 | ||
229 | $this->click("_qf_Fee_upload-bottom"); | |
230 | ||
231 | // Wait for "saved" status msg | |
ed174dea | 232 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); |
233 | $this->waitForTextPresent("'Fees' information has been saved."); | |
6a488035 TO |
234 | } |
235 | ||
4cbe18b8 EM |
236 | /** |
237 | * @param $registerIntro | |
238 | * @param bool $multipleRegistrations | |
239 | */ | |
6a488035 TO |
240 | function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE) { |
241 | // Go to Online Registration tab | |
242 | $this->click("link=Online Registration"); | |
243 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); | |
244 | ||
245 | $this->check("is_online_registration"); | |
246 | ||
247 | $this->assertChecked("is_online_registration"); | |
248 | if ($multipleRegistrations) { | |
249 | $this->check("is_multiple_registrations"); | |
250 | $this->assertChecked("is_multiple_registrations"); | |
251 | } | |
252 | ||
60709d21 | 253 | $this->click('intro_text-plain'); |
6a488035 TO |
254 | $this->fillRichTextField("intro_text", $registerIntro); |
255 | ||
256 | // enable confirmation email | |
257 | $this->click("CIVICRM_QFID_1_is_email_confirm"); | |
258 | $this->type("confirm_from_name", "Jane Doe"); | |
259 | $this->type("confirm_from_email", "jane.doe@example.org"); | |
260 | ||
261 | $this->click("_qf_Registration_upload-bottom"); | |
ed174dea | 262 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); |
263 | $this->waitForTextPresent("'Online Registration' information has been saved."); | |
6a488035 TO |
264 | } |
265 | ||
4cbe18b8 EM |
266 | /** |
267 | * @param $eventTitle | |
268 | * @param $pageId | |
269 | * @param $firstName | |
270 | * @param $lastName | |
271 | * @param $middleName | |
272 | * @param $email | |
273 | * @param int $numberRegistrations | |
274 | * @param $campaignType | |
275 | * @param bool $anonymous | |
276 | */ | |
6a488035 TO |
277 | function _testOnlineRegistration($eventTitle, $pageId, $firstName, $lastName, $middleName, $email, $numberRegistrations = 1, $campaignType, $anonymous = TRUE) { |
278 | $hash = substr(sha1(rand()), 0, 7); | |
279 | $contributionAmount = 600; | |
280 | ||
281 | // registering online | |
282 | if ($anonymous) { | |
42daf119 | 283 | $this->webtestLogout(); |
6a488035 TO |
284 | } |
285 | ||
286 | //participant registeration | |
287 | $firstNameParticipants = 'Jane' . substr(sha1(rand()), 0, 7); | |
288 | $lastNameParticipants = 'Smith' . substr(sha1(rand()), 0, 7); | |
289 | $emailParticipants = 'jane' . substr(sha1(rand()), 0, 7) . "@example.org"; | |
290 | ||
291 | $registerUrl = "civicrm/event/register?id={$pageId}&reset=1"; | |
292 | $this->open($this->sboxPath . $registerUrl); | |
293 | ||
01dc0aff | 294 | $this->type("first_name", "{$firstNameParticipants}"); |
295 | $this->type("last_name", "{$lastNameParticipants}"); | |
6a488035 TO |
296 | $this->select("additional_participants", "value=" . $numberRegistrations); |
297 | $this->type("email-Primary", $emailParticipants); | |
298 | $this->select("credit_card_type", "value=Visa"); | |
299 | $this->type("credit_card_number", "4111111111111111"); | |
300 | $this->type("cvv2", "000"); | |
301 | $this->select("credit_card_exp_date[M]", "value=1"); | |
302 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
303 | $this->type("billing_first_name", "{$firstNameParticipants}"); | |
304 | $this->type("billing_last_name", "{$lastNameParticipants}"); | |
305 | $this->type("billing_street_address-5", "15 Main St."); | |
306 | $this->type(" billing_city-5", "San Jose"); | |
307 | $this->select("billing_country_id-5", "value=1228"); | |
308 | $this->select("billing_state_province_id-5", "value=1004"); | |
309 | $this->type("billing_postal_code-5", "94129"); | |
310 | ||
311 | $this->click("_qf_Register_upload-bottom"); | |
312 | ||
313 | if ($numberRegistrations > 1) { | |
314 | for ($i = 1; $i <= $numberRegistrations; $i++) { | |
315 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
316 | // Look for Skip button | |
317 | $this->waitForElementPresent("_qf_Participant_{$i}_next_skip-Array"); | |
318 | $this->type("email-Primary", "{$firstName}" . substr(sha1(rand()), 0, 7) . "@example.org"); | |
319 | $this->click("_qf_Participant_{$i}_next"); | |
320 | } | |
321 | } | |
322 | ||
323 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
324 | $this->waitForElementPresent("_qf_Confirm_next-bottom"); | |
325 | $confirmStrings = array("Event Fee(s)", "Billing Name and Address", "Credit Card Information"); | |
326 | $this->assertStringsPresent($confirmStrings); | |
327 | $this->click("_qf_Confirm_next-bottom"); | |
328 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
329 | $thankStrings = array("Thank You for Registering", "Event Total", "Transaction Date"); | |
330 | $this->assertStringsPresent($thankStrings); | |
331 | ||
332 | //pcp creation via different user | |
42daf119 | 333 | $this->openCiviPage('contribute/campaign', "action=add&reset=1&pageId={$pageId}&component=event", "_qf_PCPAccount_next-bottom"); |
6a488035 TO |
334 | |
335 | $cmsUserName = 'CmsUser' . substr(sha1(rand()), 0, 7); | |
336 | ||
337 | $this->type("cms_name", $cmsUserName); | |
338 | $this->click("checkavailability"); | |
339 | $this->waitForTextPresent('This username is currently available'); | |
340 | $this->type("first_name", $firstName); | |
341 | $this->type("last_name", $lastName); | |
342 | $this->type("email-Primary", $email); | |
343 | $this->click("_qf_PCPAccount_next-bottom"); | |
344 | $this->waitForElementPresent("_qf_Campaign_upload-bottom"); | |
345 | ||
346 | $pcpTitle = 'PCPTitle' . substr(sha1(rand()), 0, 7); | |
347 | $this->type("pcp_title", $pcpTitle); | |
348 | $this->type("pcp_intro_text", "Welcome Text $hash"); | |
349 | $this->type("goal_amount", $contributionAmount); | |
350 | $this->click("_qf_Campaign_upload-bottom"); | |
351 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
352 | ||
353 | //admin pcp approval | |
354 | //login to check contribution | |
6a488035 TO |
355 | |
356 | // Log in using webtestLogin() method | |
357 | $this->webtestLogin(); | |
358 | ||
42daf119 | 359 | $this->openCiviPage('admin/pcp', 'reset=1&page_type=event', "_qf_PCP_refresh"); |
6a488035 TO |
360 | $this->select('status_id', 'value=1'); |
361 | $this->click("_qf_PCP_refresh"); | |
362 | $this->waitForElementPresent("_qf_PCP_refresh"); | |
363 | $id = explode('id=', $this->getAttribute("xpath=//div[@id='option11_wrapper']/table[@id='option11']/tbody//tr/td/a[text()='$pcpTitle']@href")); | |
364 | $pcpUrl = "civicrm/pcp/info?reset=1&id=$id[1]"; | |
365 | $this->click("xpath=//div[@id='option11_wrapper']/table[@id='option11']/tbody//tr/td/a[text()='$pcpTitle']/../../td[7]/span/a[text()='Approve']"); | |
366 | ||
367 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
368 | ||
42daf119 | 369 | $this->webtestLogout(); |
6a488035 TO |
370 | |
371 | $this->open($this->sboxPath . $pcpUrl); | |
372 | $this->waitForElementPresent("xpath=//div[@class='pcp-donate']/a"); | |
373 | $this->click("xpath=//div[@class='pcp-donate']/a"); | |
374 | $emailElement = ""; | |
375 | if ($campaignType == 'contribute') { | |
376 | $this->waitForElementPresent("_qf_Main_upload-bottom"); | |
377 | $emailElement = "email-5"; | |
378 | } | |
379 | elseif ($campaignType == 'event') { | |
380 | $this->waitForElementPresent('_qf_Register_upload-bottom'); | |
381 | $emailElement = "email-Primary"; | |
382 | } | |
383 | ||
384 | if ($campaignType == 'contribute') { | |
385 | $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", "$contributionAmount"); | |
386 | $feeLevel = NULL; | |
387 | } | |
388 | elseif ($campaignType == 'event') { | |
389 | $contributionAmount = '250.00'; | |
390 | } | |
391 | ||
42daf119 CW |
392 | $firstNameDonar = 'Andrew' . substr(sha1(rand()), 0, 7); |
393 | $lastNameDonar = 'Roger' . substr(sha1(rand()), 0, 7); | |
6a488035 | 394 | $middleNameDonar = 'Nicholas' . substr(sha1(rand()), 0, 7); |
76e86fd8 | 395 | |
333e9ca3 | 396 | if ($this->isElementPresent("first_name")) { |
397 | $this->type('first_name', $firstNameDonar); | |
398 | } | |
399 | ||
400 | if ($this->isElementPresent("last_name")) { | |
401 | $this->type('last_name', $lastNameDonar); | |
402 | } | |
6a488035 TO |
403 | $this->type("{$emailElement}", $firstNameDonar . "@example.com"); |
404 | $this->webtestAddCreditCardDetails(); | |
405 | $this->webtestAddBillingDetails($firstNameDonar, $middleNameDonar, $lastNameDonar); | |
406 | ||
407 | if ($campaignType == 'contribute') { | |
408 | $this->click("_qf_Main_upload-bottom"); | |
409 | } | |
410 | elseif ($campaignType == 'event') { | |
411 | $this->click('_qf_Register_upload-bottom'); | |
412 | } | |
413 | ||
414 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
415 | $this->waitForElementPresent("_qf_Confirm_next-bottom"); | |
416 | $this->click("_qf_Confirm_next-bottom"); | |
417 | ||
418 | if ($campaignType == 'contribute') { | |
419 | $this->waitForTextPresent("Your transaction has been processed successfully"); | |
420 | } | |
421 | elseif ($campaignType == 'event') { | |
422 | $this->waitForTextPresent("Thank You for Registering"); | |
423 | } | |
424 | ||
425 | //login to check contribution | |
6a488035 TO |
426 | $this->webtestLogin(); |
427 | ||
428 | if ($campaignType == 'event') { | |
429 | $this->_testParticipantSearchEventName($eventTitle, $lastNameDonar, $firstNameDonar, $firstName, $lastName, $contributionAmount); | |
430 | } | |
431 | elseif ($campaignType == 'contribute') { | |
432 | $this->_testSearchTest($firstNameDonar, $lastNameDonar, $firstName, $lastName, $contributionAmount); | |
433 | } | |
434 | } | |
435 | ||
4cbe18b8 EM |
436 | /** |
437 | * @param $campaignType | |
438 | * @param $contributionPageId | |
439 | * | |
440 | * @return null | |
441 | */ | |
6a488035 TO |
442 | function _testEventPcpAdd($campaignType, $contributionPageId) { |
443 | $hash = substr(sha1(rand()), 0, 7); | |
444 | $isPcpApprovalNeeded = TRUE; | |
445 | ||
446 | // fill in step 9 (Enable Personal Campaign Pages) | |
447 | $this->click('link=Personal Campaigns'); | |
448 | $this->waitForElementPresent('pcp_active'); | |
449 | $this->click('pcp_active'); | |
450 | $this->waitForElementPresent('_qf_Event_upload-bottom'); | |
451 | ||
452 | $this->select('target_entity_type', "value={$campaignType}"); | |
453 | ||
454 | if ($campaignType == 'contribute' && !empty($contributionPageId)) { | |
455 | ||
456 | $this->select('target_entity_id', "value={$contributionPageId}"); | |
457 | ||
458 | } | |
459 | ||
460 | if (!$isPcpApprovalNeeded) { | |
461 | ||
462 | $this->click('is_approval_needed'); | |
463 | ||
464 | } | |
465 | $this->type('notify_email', "$hash@example.name"); | |
466 | $this->select('supporter_profile_id', 'value=2'); | |
467 | $this->type('tellfriend_limit', 7); | |
468 | $this->type('link_text', "'Create Personal Campaign Page' link text $hash"); | |
469 | ||
470 | $this->click('_qf_Event_upload-bottom'); | |
471 | $this->waitForElementPresent('_qf_Event_upload-bottom'); | |
ed174dea | 472 | $text = "'Personal Campaigns' information has been saved."; |
a471a3b6 | 473 | $this->waitForText('crm-notification-container', $text); |
6a488035 TO |
474 | |
475 | // parse URL to grab the contribution page id | |
a471a3b6 | 476 | return $this->urlArg('id'); |
6a488035 TO |
477 | } |
478 | ||
4cbe18b8 EM |
479 | /** |
480 | * @param $eventName | |
481 | * @param $lastNameDonar | |
482 | * @param $firstNameDonar | |
483 | * @param $firstNameCreator | |
484 | * @param $lastNameCreator | |
485 | * @param $amount | |
486 | */ | |
6a488035 TO |
487 | function _testParticipantSearchEventName($eventName, $lastNameDonar, $firstNameDonar, $firstNameCreator, $lastNameCreator, $amount) { |
488 | $sortName = $lastNameDonar . ', ' . $firstNameDonar; | |
071a6d2e | 489 | $this->openCiviPage("event/search", "reset=1"); |
6a488035 | 490 | |
ed174dea | 491 | $this->select2("event_id", $eventName); |
6a488035 | 492 | |
c3ad8633 | 493 | $this->clickLink("_qf_Search_refresh"); |
6a488035 | 494 | |
ed174dea | 495 | $this->clickLink("xpath=//div[@id='participantSearch']/table/tbody/tr[1]/td[@class='crm-participant-sort_name']/a[text()='{$sortName}']/../../td[11]/span/a[text()='View']", "xpath=//table[@class='selector row-highlight']/tbody/tr/td[8]/span/a[text()='View']", FALSE); |
496 | $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr/td[8]/span/a[text()='View']"); | |
497 | $this->waitForElementPresent('_qf_ContributionView_cancel-bottom'); | |
6a488035 TO |
498 | |
499 | $this->webtestVerifyTabularData( | |
500 | array( | |
501 | 'From' => "{$firstNameDonar} {$lastNameDonar}", | |
502 | 'Total Amount' => $amount, | |
503 | 'Contribution Status' => 'Completed', | |
6a488035 TO |
504 | ) |
505 | ); | |
333e9ca3 | 506 | $softCreditor = "{$firstNameCreator} {$lastNameCreator}"; |
ed174dea | 507 | $this->verifyText("xpath=//div[@id='PCPView']/div[2]//table[@class='crm-info-panel']/tbody/tr[2]/td[2]", preg_quote($softCreditor), 'In line ' . __LINE__); |
6a488035 TO |
508 | } |
509 | ||
4cbe18b8 EM |
510 | /** |
511 | * @param $firstName | |
512 | * @param $lastName | |
513 | * @param $pcpCreatorFirstName | |
514 | * @param $pcpCreatorLastName | |
515 | * @param $amount | |
516 | */ | |
6a488035 TO |
517 | function _testSearchTest($firstName, $lastName, $pcpCreatorFirstName, $pcpCreatorLastName, $amount) { |
518 | $sortName = "$pcpCreatorLastName, $pcpCreatorFirstName"; | |
519 | $displayName = "$firstName $lastName"; | |
520 | ||
521 | // visit contact search page | |
071a6d2e | 522 | $this->openCiviPage("contact/search", "reset=1"); |
6a488035 TO |
523 | |
524 | // fill name as first_name | |
525 | $this->type("css=.crm-basic-criteria-form-block input#sort_name", $pcpCreatorFirstName); | |
526 | ||
527 | // click to search | |
beea38fc | 528 | $this->clickLink("_qf_Basic_refresh"); |
6a488035 TO |
529 | |
530 | $this->click("xpath=//div[@class='crm-search-results']//table/tbody//tr/td[3]/a[text()='{$sortName}']"); | |
531 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
532 | ||
533 | $this->click("css=li#tab_contribute a"); | |
ed174dea | 534 | $this->waitForElementPresent("xpath=//form[@id='Search']/div[@class='view-content']/table[2]/tbody/tr[@id='rowid']/td/a[text()='$displayName']"); |
535 | $this->click("xpath=//form[@id='Search']/div[@class='view-content']/table[2]/tbody/tr[@id='rowid']/td[8]/a[text()='View']"); | |
6a488035 TO |
536 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
537 | ||
538 | $this->webtestVerifyTabularData( | |
539 | array( | |
540 | 'From' => "{$firstName} {$lastName}", | |
541 | 'Net Amount' => $amount, | |
542 | 'Contribution Status' => 'Completed', | |
6a488035 TO |
543 | ) |
544 | ); | |
333e9ca3 | 545 | $softCreditor = "{$pcpCreatorFirstName} {$pcpCreatorLastName}"; |
ed174dea | 546 | $this->verifyText("xpath=//div[@id='PCPView']/div[2]//table[@class='crm-info-panel']/tbody/tr[2]/td[2]", preg_quote($softCreditor), 'In line ' . __LINE__); |
6a488035 TO |
547 | } |
548 | } | |
549 |