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_Contribute_OnlineContributionTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Contribute_OnlineContributionTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testOnlineContributionAdd() { |
6a488035 TO |
39 | $this->webtestLogin(); |
40 | ||
c3ad8633 CW |
41 | // Use default payment processor |
42 | $processorName = 'Test Processor'; | |
6a488035 | 43 | $processorType = 'Dummy'; |
42daf119 CW |
44 | $pageTitle = substr(sha1(rand()), 0, 7); |
45 | $rand = 2 * rand(10, 50); | |
46 | $hash = substr(sha1(rand()), 0, 7); | |
6a488035 | 47 | $amountSection = TRUE; |
42daf119 CW |
48 | $payLater = FALSE; |
49 | $onBehalf = FALSE; | |
50 | $pledges = FALSE; | |
51 | $recurring = FALSE; | |
52 | $memberships = FALSE; | |
53 | $friend = TRUE; | |
54 | $profilePreId = 1; | |
6a488035 | 55 | $profilePostId = NULL; |
42daf119 CW |
56 | $premiums = FALSE; |
57 | $widget = FALSE; | |
58 | $pcp = FALSE; | |
6a488035 TO |
59 | $memPriceSetId = NULL; |
60 | ||
61 | // create a new online contribution page | |
62 | // create contribution page with randomized title and default params | |
63 | $pageId = $this->webtestAddContributionPage($hash, | |
64 | $rand, | |
65 | $pageTitle, | |
66 | array($processorName => $processorType), | |
67 | $amountSection, | |
68 | $payLater, | |
69 | $onBehalf, | |
70 | $pledges, | |
71 | $recurring, | |
72 | $memberships, | |
73 | $memPriceSetId, | |
74 | $friend, | |
75 | $profilePreId, | |
76 | $profilePostId, | |
77 | $premiums, | |
78 | $widget, | |
79 | $pcp | |
80 | ); | |
81 | ||
82 | //logout | |
42daf119 | 83 | $this->webtestLogout(); |
6a488035 TO |
84 | |
85 | //Open Live Contribution Page | |
f1224701 | 86 | $this->openCiviPage("contribute/transact", "reset=1&id=$pageId&action=preview", "_qf_Main_upload-bottom"); |
6a488035 TO |
87 | |
88 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
89 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
90 | $honorFirstName = 'In' . substr(sha1(rand()), 0, 4); | |
91 | $honorLastName = 'Hon' . substr(sha1(rand()), 0, 7); | |
92 | $honorEmail = $honorFirstName . "@example.com"; | |
93 | $honorSortName = $honorLastName . ', ' . $honorFirstName; | |
76e86fd8 | 94 | $honorDisplayName = 'Ms. ' . $honorFirstName . ' ' . $honorLastName; |
6a488035 TO |
95 | |
96 | $this->type("email-5", $firstName . "@example.com"); | |
97 | ||
98 | $this->type("first_name", $firstName); | |
99 | $this->type("last_name", $lastName); | |
100 | ||
101 | $this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input"); | |
102 | $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 100); | |
103 | ||
104 | $streetAddress = "100 Main Street"; | |
105 | $this->type("street_address-1", $streetAddress); | |
106 | $this->type("city-1", "San Francisco"); | |
107 | $this->type("postal_code-1", "94117"); | |
108 | $this->select("country-1", "value=1228"); | |
109 | $this->select("state_province-1", "value=1001"); | |
6a488035 | 110 | // Honoree Info |
f1224701 | 111 | $this->click("xpath=id('Main')/div[3]/fieldset/div[2]/div/label[text()='In Honor of']"); |
6a488035 | 112 | |
1421174e | 113 | $this->select("honor[prefix_id]", "label=Ms."); |
114 | $this->type("honor[first_name]", $honorFirstName); | |
115 | $this->type("honor[last_name]", $honorLastName); | |
116 | $this->type("honor[email-1]", $honorEmail); | |
76e86fd8 | 117 | |
6a488035 TO |
118 | //Credit Card Info |
119 | $this->select("credit_card_type", "value=Visa"); | |
120 | $this->type("credit_card_number", "4111111111111111"); | |
121 | $this->type("cvv2", "000"); | |
122 | $this->select("credit_card_exp_date[M]", "value=1"); | |
123 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
124 | ||
125 | //Billing Info | |
126 | $this->type("billing_first_name", $firstName . "billing"); | |
127 | $this->type("billing_last_name", $lastName . "billing"); | |
128 | $this->type("billing_street_address-5", "15 Main St."); | |
129 | $this->type(" billing_city-5", "San Jose"); | |
130 | $this->select("billing_country_id-5", "value=1228"); | |
131 | $this->select("billing_state_province_id-5", "value=1004"); | |
132 | $this->type("billing_postal_code-5", "94129"); | |
225a8648 | 133 | $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); |
6a488035 TO |
134 | |
135 | $this->click("_qf_Confirm_next-bottom"); | |
136 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
137 | ||
138 | //login to check contribution | |
6a488035 TO |
139 | |
140 | // Log in using webtestLogin() method | |
141 | $this->webtestLogin(); | |
142 | ||
143 | //Find Contribution | |
42daf119 | 144 | $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); |
8fb46c61 | 145 | $this->type("sort_name", "$lastName $firstName"); |
f1224701 | 146 | $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); |
deeea38d | 147 | $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']"); |
2815a5aa | 148 | $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); |
6a488035 TO |
149 | |
150 | //View Contribution Record and verify data | |
151 | $expected = array( | |
42daf119 CW |
152 | 'From' => "{$firstName} {$lastName}", |
153 | 'Financial Type' => 'Donation', | |
154 | 'Total Amount' => '100.00', | |
6a488035 | 155 | 'Contribution Status' => 'Completed', |
6a488035 TO |
156 | ); |
157 | $this->webtestVerifyTabularData($expected); | |
1421174e | 158 | //View Soft Credit record of type 'Honor of' |
159 | $this->waitForTextPresent($honorDisplayName); | |
160 | $this->waitForTextPresent('100.00 (In Honor of)'); | |
161 | ||
6a488035 TO |
162 | // Check for Honoree contact created |
163 | $this->click("css=input#sort_name_navigation"); | |
164 | $this->type("css=input#sort_name_navigation", $honorSortName); | |
165 | $this->typeKeys("css=input#sort_name_navigation", $honorSortName); | |
166 | ||
167 | // wait for result list | |
0ecb5006 | 168 | $this->waitForElementPresent("css=ul.ui-autocomplete li"); |
6a488035 TO |
169 | |
170 | // visit contact summary page | |
0ecb5006 | 171 | $this->click("css=ul.ui-autocomplete li"); |
6a488035 TO |
172 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
173 | ||
174 | // Is contact present? | |
175 | $this->assertTrue($this->isTextPresent("$honorDisplayName"), "Honoree contact not found."); | |
76e86fd8 | 176 | |
2b63342b | 177 | // CRM-16064 - Contributions pricesets charge $1 more than selected |
178 | $contributionAmt = number_format($rand, 2); | |
179 | $label = "Label $hash"; | |
180 | $this->_verifyContributionAmt($pageId, $contributionAmt, $label); | |
181 | ||
6c6e6187 | 182 | } |
3fb990f4 | 183 | |
92915c55 | 184 | public function testOnlineContributionWithZeroAmount() { |
3fb990f4 RN |
185 | $this->webtestLogin(); |
186 | ||
c3ad8633 CW |
187 | // Use default payment processor |
188 | $processorName = 'Test Processor'; | |
3fb990f4 RN |
189 | $processorType = 'Dummy'; |
190 | $pageTitle = substr(sha1(rand()), 0, 7); | |
191 | $rand = 2 * rand(10, 50); | |
192 | $hash = substr(sha1(rand()), 0, 7); | |
193 | $amountSection = TRUE; | |
194 | $payLater = FALSE; | |
195 | $onBehalf = FALSE; | |
196 | $pledges = FALSE; | |
197 | $recurring = FALSE; | |
198 | $memberships = FALSE; | |
199 | $friend = FALSE; | |
200 | $profilePreId = NULL; | |
201 | $profilePostId = NULL; | |
202 | $premiums = FALSE; | |
203 | $widget = FALSE; | |
204 | $pcp = FALSE; | |
205 | $memPriceSetId = NULL; | |
206 | ||
207 | // create a new online contribution page | |
208 | // create contribution page with randomized title and default params | |
209 | $pageId = $this->webtestAddContributionPage($hash, | |
210 | $rand, | |
211 | $pageTitle, | |
212 | array($processorName => $processorType), | |
213 | $amountSection, | |
214 | $payLater, | |
215 | $onBehalf, | |
216 | $pledges, | |
217 | $recurring, | |
218 | $memberships, | |
219 | $memPriceSetId, | |
220 | $friend, | |
221 | $profilePreId, | |
222 | $profilePostId, | |
223 | $premiums, | |
224 | $widget, | |
225 | $pcp | |
226 | ); | |
1421174e | 227 | |
3fb990f4 RN |
228 | $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=$pageId", '_qf_Amount_cancel-bottom'); |
229 | $this->type('label_1', "Label $hash"); | |
230 | $this->type('value_1', 0); | |
231 | $this->clickLink('_qf_Amount_upload_done-top'); | |
232 | ||
233 | //Contribution using Contribution Options | |
234 | $this->_doContributionAndVerifyData($pageId); | |
1421174e | 235 | |
3fb990f4 RN |
236 | //add priceset |
237 | $this->openCiviPage("admin/price", "reset=1&action=add", '_qf_Set_next-bottom'); | |
238 | $this->type('title', "Test Priceset $rand"); | |
239 | $this->check('extends_2'); | |
240 | $this->select("financial_type_id", "label=Donation"); | |
0512e9c6 | 241 | $this->clickLink('_qf_Set_next-bottom', '_qf_Field_next-bottom', FALSE); |
3fb990f4 RN |
242 | $sid = $this->urlArg('sid'); |
243 | //add field | |
244 | $this->type('label', "Testfield"); | |
245 | $this->select('html_type', "value=Radio"); | |
246 | $this->type('option_label_1', 'test Label'); | |
247 | $this->type('option_amount_1', 0.00); | |
0512e9c6 | 248 | $this->clickLink('_qf_Field_next_new-bottom', '_qf_Field_next-bottom', FALSE); |
3fb990f4 RN |
249 | $this->openCiviPage("admin/contribute/amount", "reset=1&action=update&id=$pageId", '_qf_Amount_cancel-bottom'); |
250 | $this->select('price_set_id', "value=$sid"); | |
0512e9c6 | 251 | $this->clickLink('_qf_Amount_upload_done-bottom', FALSE); |
3fb990f4 RN |
252 | |
253 | //Contribution using priceset | |
1421174e | 254 | $this->_doContributionAndVerifyData($pageId, TRUE); |
3fb990f4 RN |
255 | } |
256 | ||
4cbe18b8 | 257 | /** |
100fef9d | 258 | * @param int $pageId |
4cbe18b8 EM |
259 | * @param bool $priceSet |
260 | */ | |
00be9182 | 261 | public function _doContributionAndVerifyData($pageId, $priceSet = FALSE) { |
3fb990f4 RN |
262 | //logout |
263 | $this->webtestLogout(); | |
264 | $amountLabel = 'Total Amount'; | |
b4a57e40 | 265 | $amountValue = '0.00'; |
3fb990f4 | 266 | //Open Live Contribution Page |
f1224701 | 267 | $this->openCiviPage("contribute/transact", "reset=1&id=$pageId&action=preview", "_qf_Main_upload-bottom"); |
3fb990f4 RN |
268 | |
269 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
270 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
08936462 WA |
271 | $email = $firstName . "@example.com"; |
272 | $this->type("email-5", $email); | |
3fb990f4 RN |
273 | |
274 | if ($priceSet) { | |
275 | $this->click("xpath=//div[@id='priceset']/div/div[2]/div/span/input"); | |
276 | $amountLabel = 'Contribution Amount'; | |
277 | $amountValue = 'Contribution Total: $ 0.00'; | |
278 | } | |
279 | ||
280 | //Credit Card Info | |
281 | $this->select("credit_card_type", "value=Visa"); | |
282 | $this->type("credit_card_number", "4111111111111111"); | |
283 | $this->type("cvv2", "000"); | |
284 | $this->select("credit_card_exp_date[M]", "value=1"); | |
285 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
286 | ||
287 | //Billing Info | |
288 | $this->type("billing_first_name", $firstName); | |
289 | $this->type("billing_last_name", $lastName); | |
290 | $this->type("billing_street_address-5", "15 Main St."); | |
291 | $this->type(" billing_city-5", "San Jose"); | |
292 | $this->select("billing_country_id-5", "value=1228"); | |
293 | $this->select("billing_state_province_id-5", "value=1004"); | |
294 | $this->type("billing_postal_code-5", "94129"); | |
295 | $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); | |
296 | ||
297 | $this->clickLink("_qf_Confirm_next-bottom", NULL); | |
298 | ||
3fb990f4 RN |
299 | //login to check contribution |
300 | ||
301 | // Log in using webtestLogin() method | |
302 | $this->webtestLogin(); | |
303 | ||
6c6e6187 | 304 | //Find Contribution |
3fb990f4 | 305 | $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); |
08936462 | 306 | $this->type("sort_name", "$email"); |
7051f2e5 | 307 | $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); |
08936462 WA |
308 | $this->waitForAjaxContent(); |
309 | $this->click("xpath=//div[@class='crm-accordion-wrapper crm-contribution_search_form-accordion ']/div[2]/table/tbody/tr[8]/td[1]/table/tbody/tr[3]/td[2]/label[1]"); | |
deeea38d WA |
310 | $this->clickLink("_qf_Search_refresh", "xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", FALSE); |
311 | $this->clickLink("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[10]/span//a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); | |
3fb990f4 RN |
312 | |
313 | //View Contribution Record and verify data | |
314 | $expected = array( | |
6e677443 | 315 | 'From' => "{$firstName} {$lastName}", |
3fb990f4 RN |
316 | 'Financial Type' => 'Donation', |
317 | $amountLabel => $amountValue, | |
21dfd5f5 | 318 | 'Contribution Status' => 'Completed', |
3fb990f4 RN |
319 | ); |
320 | $this->webtestVerifyTabularData($expected); | |
6a488035 | 321 | } |
96025800 | 322 | |
2b63342b | 323 | public function _verifyContributionAmt($pageId, $contributionAmt, $label) { |
324 | // logout | |
325 | $this->webtestLogout(); | |
326 | ||
327 | //Open Live Contribution Page | |
f1224701 | 328 | $this->openCiviPage("contribute/transact", "reset=1&id=$pageId&action=preview", "_qf_Main_upload-bottom"); |
2b63342b | 329 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); |
330 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
331 | $this->type("email-5", $firstName . "@example.com"); | |
332 | ||
333 | $this->type("first_name", $firstName); | |
334 | $this->type("last_name", $lastName); | |
335 | $this->check("xpath=//div[@id='priceset']/div[contains(@class, 'contribution_amount-section')]//div[contains(@class, 'contribution_amount-row1')]/span/input"); | |
336 | $streetAddress = "100 Main Street"; | |
337 | $this->type("street_address-1", $streetAddress); | |
338 | $this->type("city-1", "San Francisco"); | |
339 | $this->type("postal_code-1", "94117"); | |
340 | $this->select("country-1", "value=1228"); | |
341 | $this->select("state_province-1", "value=1001"); | |
342 | ||
343 | //Credit Card Info | |
344 | $this->select("credit_card_type", "value=Visa"); | |
345 | $this->type("credit_card_number", "4111111111111111"); | |
346 | $this->type("cvv2", "000"); | |
347 | $this->select("credit_card_exp_date[M]", "value=1"); | |
348 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
349 | ||
350 | //Billing Info | |
351 | $this->type("billing_first_name", $firstName . "billing"); | |
352 | $this->type("billing_last_name", $lastName . "billing"); | |
353 | $this->type("billing_street_address-5", "15 Main St."); | |
354 | $this->type(" billing_city-5", "San Jose"); | |
355 | $this->select("billing_country_id-5", "value=1228"); | |
356 | $this->select("billing_state_province_id-5", "value=1004"); | |
357 | $this->type("billing_postal_code-5", "94129"); | |
358 | $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); | |
359 | ||
360 | $this->assertElementContainsText("xpath=//div[contains(@class, 'amount_display-group')]//div[@class='display-block']/strong", "$ $contributionAmt - $label", "Contribution amount does not match"); | |
361 | $this->clickLink("_qf_Confirm_next-bottom"); | |
362 | $this->assertElementContainsText("xpath=//div[contains(@class, 'amount_display-group')]//div[@class='display-block']/strong", "$ $contributionAmt - $label", "Contribution amount does not match"); | |
363 | // Log in using webtestLogin() method | |
364 | $this->webtestLogin(); | |
365 | $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); | |
366 | ||
367 | $this->type("sort_name", "$lastName $firstName"); | |
f1224701 | 368 | $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); |
4dc8abb7 WA |
369 | $this->clickLink("_qf_Search_refresh", "xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); |
370 | $this->clickLink("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']", "_qf_ContributionView_cancel-bottom", FALSE); | |
2b63342b | 371 | |
372 | //View Contribution Record and verify data | |
373 | $expected = array( | |
374 | 'From' => "{$firstName} {$lastName}", | |
375 | 'Financial Type' => 'Donation', | |
376 | 'Total Amount' => $contributionAmt, | |
377 | 'Contribution Status' => 'Completed', | |
378 | ); | |
379 | $this->webtestVerifyTabularData($expected); | |
380 | } | |
65158765 | 381 | |
feb02c31 | 382 | public function testOnlineContributionWithPremium() { |
810fa73d | 383 | //CRM-16713: Contribution search by premiums on find contribution form. |
feb02c31 WA |
384 | $this->webtestLogin(); |
385 | ||
386 | // Use default payment processor | |
387 | $processorName = 'Test Processor'; | |
388 | $processorType = 'Dummy'; | |
389 | $pageTitle = substr(sha1(rand()), 0, 7); | |
390 | $rand = 2 * rand(10, 50); | |
391 | $hash = substr(sha1(rand()), 0, 7); | |
392 | $amountSection = TRUE; | |
393 | $payLater = FALSE; | |
394 | $onBehalf = FALSE; | |
395 | $pledges = FALSE; | |
396 | $recurring = FALSE; | |
397 | $memberships = FALSE; | |
398 | $friend = TRUE; | |
399 | $profilePreId = 1; | |
400 | $profilePostId = NULL; | |
401 | $premiums = TRUE; | |
402 | $widget = FALSE; | |
403 | $pcp = FALSE; | |
404 | $memPriceSetId = NULL; | |
405 | ||
406 | // create a new online contribution page | |
407 | // create contribution page with randomized title and default params | |
408 | $pageId = $this->webtestAddContributionPage($hash, | |
409 | $rand, | |
410 | $pageTitle, | |
411 | array($processorName => $processorType), | |
412 | $amountSection, | |
413 | $payLater, | |
414 | $onBehalf, | |
415 | $pledges, | |
416 | $recurring, | |
417 | $memberships, | |
418 | $memPriceSetId, | |
419 | $friend, | |
420 | $profilePreId, | |
421 | $profilePostId, | |
422 | $premiums, | |
423 | $widget, | |
424 | $pcp | |
425 | ); | |
426 | ||
427 | //logout | |
428 | $this->webtestLogout(); | |
429 | ||
430 | //Open Live Contribution Page | |
f1224701 | 431 | $this->openCiviPage("contribute/transact", "reset=1&id=$pageId&action=preview", "_qf_Main_upload-bottom"); |
feb02c31 WA |
432 | |
433 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
434 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
435 | ||
436 | $this->type("email-5", $firstName . "@example.com"); | |
437 | ||
438 | $this->waitForAjaxContent(); | |
439 | $this->click("xpath=//div[@id='premiums-listings']/div[2]/div[1]"); | |
440 | $this->waitForAjaxContent(); | |
441 | $this->select("xpath=//div[@id='premiums']/fieldset/div[@id='premiums-listings']/div[2]/div[2]/div[2]/div[4]/p/select", "value=Black"); | |
442 | ||
443 | $this->type("first_name", $firstName); | |
444 | $this->type("last_name", $lastName); | |
445 | ||
446 | $this->click("xpath=//div[@class='crm-section other_amount-section']//div[2]/input"); | |
447 | $this->type("xpath=//div[@class='crm-section other_amount-section']//div[2]/input", 100); | |
448 | ||
449 | $streetAddress = "100 Main Street"; | |
450 | $this->type("street_address-1", $streetAddress); | |
451 | $this->type("city-1", "San Francisco"); | |
452 | $this->type("postal_code-1", "94117"); | |
453 | $this->select("country-1", "value=1228"); | |
454 | $this->select("state_province-1", "value=1001"); | |
455 | ||
456 | //Credit Card Info | |
457 | $this->select("credit_card_type", "value=Visa"); | |
458 | $this->type("credit_card_number", "4111111111111111"); | |
459 | $this->type("cvv2", "000"); | |
460 | $this->select("credit_card_exp_date[M]", "value=1"); | |
461 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
462 | ||
463 | //Billing Info | |
464 | $this->type("billing_first_name", $firstName . "billing"); | |
465 | $this->type("billing_last_name", $lastName . "billing"); | |
466 | $this->type("billing_street_address-5", "15 Main St."); | |
467 | $this->type(" billing_city-5", "San Jose"); | |
468 | $this->select("billing_country_id-5", "value=1228"); | |
469 | $this->select("billing_state_province_id-5", "value=1004"); | |
470 | $this->type("billing_postal_code-5", "94129"); | |
471 | $this->clickLink("_qf_Main_upload-bottom", "_qf_Confirm_next-bottom"); | |
472 | ||
473 | $this->click("_qf_Confirm_next-bottom"); | |
474 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
475 | ||
476 | // Log in using webtestLogin() method | |
477 | $this->webtestLogin(); | |
478 | ||
479 | //Find Contribution | |
480 | $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low"); | |
f1224701 | 481 | $this->click("xpath=//tr/td[1]/label[contains(text(), 'Contribution is a Test?')]/../../td[2]/label[contains(text(), 'Yes')]/preceding-sibling::input[1]"); |
feb02c31 WA |
482 | $this->type("sort_name", "$lastName $firstName"); |
483 | $this->multiselect2('contribution_product_id', array('Coffee Mug')); | |
484 | $this->click("_qf_Search_refresh"); | |
deeea38d WA |
485 | $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']/tbody//tr/td[10]/span//a[text()='View']"); |
486 | $this->click("xpath=//table[@class='selector row-highlight']/tbody//tr/td[2]/a[text()='{$lastName}, {$firstName}']/../../td[10]/span//a[text()='View']"); | |
feb02c31 WA |
487 | $this->waitForElementPresent("xpath=//button//span[contains(text(),'Done')]"); |
488 | ||
489 | //View Contribution Record and verify data | |
490 | $expected = array( | |
491 | 'From' => "{$firstName} {$lastName}", | |
492 | 'Financial Type' => 'Donation', | |
493 | 'Total Amount' => '100.00', | |
494 | 'Contribution Status' => 'Completed', | |
495 | 'Premium' => 'Coffee Mug', | |
496 | ); | |
497 | $this->webtestVerifyTabularData($expected); | |
498 | } | |
499 | ||
3fb990f4 | 500 | } |