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