Merge pull request #11688 from eileenmcnaughton/custom
[civicrm-core.git] / tests / phpunit / WebTest / Pledge / ContactContextPledgePaymentAddTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
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';
28
29 /**
30 * Class WebTest_Pledge_ContactContextPledgePaymentAddTest
31 */
32 class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
38 public function testAddPledgePaymentWithAdjustPledgePaymentSchedule() {
39 $this->webtestLogin();
40 $this->openCiviPage('admin/setting/localization', 'reset=1');
41 $this->select("currencyLimit", "value=FJD");
42 $this->click("add");
43 $this->click("_qf_Localization_next-bottom");
44 $this->waitForPageToLoad($this->getTimeoutMsec());
45
46 // create unique name
47 $name = substr(sha1(rand()), 0, 7);
48 $firstName = 'Adam' . $name;
49 $lastName = 'Jones' . $name;
50
51 // create new contact
52 $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com");
53
54 // wait for action element
55 $this->waitForElementPresent('crm-contact-actions-link');
56
57 // now add pledge from contact summary
58 $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
59 $this->waitForElementPresent('crm-contact-actions-list');
60
61 // wait for add pledge link
62 $this->waitForElementPresent('link=Add Pledge');
63
64 $this->click('link=Add Pledge');
65
66 // wait for pledge form to load completely
67 $this->waitForElementPresent('_qf_Pledge_upload-bottom');
68
69 // check contact name on pledge form
70 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
71
72 $this->select("currency", "value=FJD");
73 $this->type("amount", "30");
74 $this->type("installments", "3");
75 $this->select("frequency_unit", "value=week");
76 $this->type("frequency_day", "2");
77
78 $this->webtestFillDate('acknowledge_date', 'now');
79 $this->select("financial_type_id", "label=Donation");
80
81 $this->select("contribution_page_id", "value=3");
82
83 //PaymentReminders
84 $this->click("PaymentReminders");
85 $this->waitForElementPresent("additional_reminder_day");
86 $this->type("initial_reminder_day", "4");
87 $this->type("max_reminders", "2");
88 $this->type("additional_reminder_day", "4");
89
90 $this->click("_qf_Pledge_upload-bottom");
91 $this->waitForElementPresent('link=Add Pledge');
92
93 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
94 $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']");
95 //click through to the Pledge view screen
96 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
97 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
98 $pledgeDate = date('F jS, Y', strtotime('now'));
99
100 $this->webtestVerifyTabularData(array(
101 'Pledge By' => $firstName . ' ' . $lastName,
102 'Total Pledge Amount' => '$ 30.00',
103 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
104 'Payments are due on the' => '2 day of the period',
105 'Pledge Made' => $pledgeDate,
106 'Financial Type' => 'Donation',
107 'Pledge Status' => 'Pending',
108 'Initial Reminder Day' => '4 days prior to schedule date',
109 'Maximum Reminders Send' => 2,
110 'Send additional reminders' => '4 days after the last one sent',
111 )
112 );
113
114 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
115 $this->waitForAjaxContent();
116 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a");
117 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
118 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
119 $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
120 $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
121 $this->waitForElementPresent("adjust-option-type");
122 $this->type("total_amount", "5");
123 $this->click("_qf_Contribution_upload");
124 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
125
126 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
127 $this->waitForAjaxContent();
128 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
129
130 $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']/tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']");
131 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']");
132 $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
133 $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
134 $this->waitForElementPresent("adjust-option-type");
135 $this->type("total_amount", "10");
136
137 $this->click("_qf_Contribution_upload");
138 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
139
140 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
141 //click through to the Pledge view screen
142 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
143 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
144 $pledgeDate = date('F jS, Y', strtotime('now'));
145
146 $this->webtestVerifyTabularData(array(
147 'Pledge By' => $firstName . ' ' . $lastName,
148 'Total Pledge Amount' => '$ 30.00',
149 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
150 'Payments are due on the' => '2 day of the period',
151 'Pledge Made' => $pledgeDate,
152 'Financial Type' => 'Donation',
153 'Pledge Status' => 'In Progress',
154 'Initial Reminder Day' => '4 days prior to schedule date',
155 'Maximum Reminders Send' => 2,
156 'Send additional reminders' => '4 days after the last one sent',
157 )
158 );
159
160 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
161 $this->waitForAjaxContent();
162 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
163 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']");
164 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']");
165 $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
166
167 $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
168 $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
169 $this->waitForElementPresent("adjust-option-type");
170 $this->type("total_amount", "10");
171
172 $this->waitForElementPresent("_qf_Contribution_upload");
173 $this->click("_qf_Contribution_upload");
174 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
175
176 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
177 $this->waitForAjaxContent();
178 $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a");
179 $this->waitForAjaxContent();
180 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[5]/td[8]/a[text()='Record Payment']");
181 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[5]/td[8]/a[text()='Record Payment']");
182
183 $this->waitForElementPresent("_qf_Contribution_upload");
184 $this->click("_qf_Contribution_upload");
185 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
186
187 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
188 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[10]/span/a[text()='View']");
189
190 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
191 $this->webtestVerifyTabularData(array(
192 'Pledge By' => $firstName . ' ' . $lastName,
193 'Total Pledge Amount' => '$ 30.00',
194 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
195 'Payments are due on the' => '2 day of the period',
196 'Pledge Made' => $pledgeDate,
197 'Financial Type' => 'Donation',
198 'Pledge Status' => 'Completed',
199 'Initial Reminder Day' => '4 days prior to schedule date',
200 'Maximum Reminders Send' => 2,
201 'Send additional reminders' => '4 days after the last one sent',
202 )
203 );
204 $this->openCiviPage('admin/setting/localization', 'reset=1');
205 $this->waitForElementPresent("currencyLimit");
206 $this->select("currencyLimit", "value=FJD");
207 $this->click("remove");
208 $this->click("_qf_Localization_next-bottom");
209 $this->waitForPageToLoad($this->getTimeoutMsec());
210 }
211
212 public function testAddPledgePaymentWithAdjustTotalPledgeAmount() {
213 $this->webtestLogin();
214 // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg
215 $this->enableDisablePopups(FALSE);
216
217 // create unique name
218 $name = substr(sha1(rand()), 0, 7);
219 $firstName = 'Adam' . $name;
220 $lastName = 'Jones' . $name;
221
222 // create new contact
223 $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com");
224
225 // wait for action element
226 $this->waitForElementPresent('crm-contact-actions-link');
227
228 // now add pledge from contact summary
229 $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
230 $this->waitForElementPresent('crm-contact-actions-list');
231
232 // wait for add plegde link
233 $this->waitForElementPresent('link=Add Pledge');
234
235 $this->click('link=Add Pledge');
236
237 // wait for pledge form to load completely
238 $this->waitForElementPresent('_qf_Pledge_upload-bottom');
239
240 // check contact name on pledge form
241 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
242
243 $this->type("amount", "30");
244 $this->type("installments", "3");
245 $this->select("frequency_unit", "value=week");
246 $this->type("frequency_day", "2");
247
248 $this->webtestFillDate('acknowledge_date', 'now');
249
250 $this->select("contribution_page_id", "value=3");
251
252 //PaymentReminders
253 $this->click("PaymentReminders");
254 $this->waitForElementPresent("additional_reminder_day");
255 $this->type("initial_reminder_day", "4");
256 $this->type("max_reminders", "2");
257 $this->type("additional_reminder_day", "4");
258
259 $this->click("_qf_Pledge_upload-bottom");
260
261 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
262
263 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
264 //click through to the Pledge view screen
265 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
266 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
267 $pledgeDate = date('F jS, Y', strtotime('now'));
268
269 $this->webtestVerifyTabularData(array(
270 'Pledge By' => $firstName . ' ' . $lastName,
271 'Total Pledge Amount' => '$ 30.00',
272 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
273 'Payments are due on the' => '2 day of the period',
274 'Pledge Made' => $pledgeDate,
275 'Financial Type' => 'Donation',
276 'Pledge Status' => 'Pending',
277 'Initial Reminder Day' => '4 days prior to schedule date',
278 'Maximum Reminders Send' => 2,
279 'Send additional reminders' => '4 days after the last one sent',
280 )
281 );
282 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
283 $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a");
284 $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
285 $this->click("xpath=//table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
286 $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
287 $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
288 $this->waitForElementPresent("adjust-option-type");
289 $this->waitForElementPresent("CIVICRM_QFID_2_option_type");
290 $this->click("CIVICRM_QFID_2_option_type");
291 $this->type("total_amount", "15");
292 $this->click("_qf_Contribution_upload");
293
294 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[10]/span/a[text()='View']");
295 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
296 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']");
297 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']");
298 $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
299 $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
300 $this->waitForElementPresent("adjust-option-type");
301 $this->waitForElementPresent("CIVICRM_QFID_2_option_type");
302 $this->click("CIVICRM_QFID_2_option_type");
303 $this->type("total_amount", "15");
304
305 $this->click("_qf_Contribution_upload");
306
307 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
308 //click through to the Pledge view screen
309 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
310 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
311 $pledgeDate = date('F jS, Y', strtotime('now'));
312
313 $this->webtestVerifyTabularData(array(
314 'Pledge By' => $firstName . ' ' . $lastName,
315 'Total Pledge Amount' => '$ 40.00',
316 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
317 'Payments are due on the' => '2 day of the period',
318 'Pledge Made' => $pledgeDate,
319 'Financial Type' => 'Donation',
320 'Pledge Status' => 'In Progress',
321 'Initial Reminder Day' => '4 days prior to schedule date',
322 'Maximum Reminders Send' => 2,
323 'Send additional reminders' => '4 days after the last one sent',
324 )
325 );
326
327 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
328 $this->waitForAjaxContent();
329 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
330 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']");
331 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']");
332
333 $this->waitForElementPresent("_qf_Contribution_upload");
334 $this->click("_qf_Contribution_upload");
335
336 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
337 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
338
339 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
340 $this->webtestVerifyTabularData(array(
341 'Pledge By' => $firstName . ' ' . $lastName,
342 'Total Pledge Amount' => '$ 40.00',
343 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
344 'Payments are due on the' => '2 day of the period',
345 'Pledge Made' => $pledgeDate,
346 'Financial Type' => 'Donation',
347 'Pledge Status' => 'Completed',
348 'Initial Reminder Day' => '4 days prior to schedule date',
349 'Maximum Reminders Send' => 2,
350 'Send additional reminders' => '4 days after the last one sent',
351 )
352 );
353 // Re-enable pop-ups to leave things in the same state
354 $this->enableDisablePopups(TRUE);
355 }
356
357 public function testAddPledgePayment() {
358 $this->webtestLogin();
359
360 // create unique name
361 $name = substr(sha1(rand()), 0, 7);
362 $firstName = 'Adam' . $name;
363 $lastName = 'Jones' . $name;
364
365 // create new contact
366 $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com");
367
368 // wait for action element
369 $this->waitForElementPresent('crm-contact-actions-link');
370
371 // now add pledge from contact summary
372 $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']");
373 $this->waitForElementPresent('crm-contact-actions-list');
374
375 // wait for add plegde link
376 $this->waitForElementPresent('link=Add Pledge');
377
378 $this->click('link=Add Pledge');
379
380 // wait for pledge form to load completely
381 $this->waitForElementPresent('_qf_Pledge_upload-bottom');
382
383 // check contact name on pledge form
384 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
385
386 $this->type("amount", "30");
387 $this->type("installments", "3");
388 $this->select("frequency_unit", "value=week");
389 $this->type("frequency_day", "2");
390
391 $this->webtestFillDate('acknowledge_date', 'now');
392
393 $this->select("contribution_page_id", "value=3");
394
395 //PaymentReminders
396 $this->click("PaymentReminders");
397 $this->waitForElementPresent("additional_reminder_day");
398 $this->type("initial_reminder_day", "4");
399 $this->type("max_reminders", "2");
400 $this->type("additional_reminder_day", "4");
401
402 $this->click("_qf_Pledge_upload-bottom");
403
404 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
405
406 //Add payments
407 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
408 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a");
409 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
410 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
411 $this->waitForElementPresent("_qf_Contribution_upload");
412 $this->click("_qf_Contribution_upload");
413 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
414
415 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
416 $this->waitForAjaxContent();
417 $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a");
418 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']");
419 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']");
420 $this->waitForElementPresent("_qf_Contribution_upload");
421 $this->click("_qf_Contribution_upload");
422
423 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
424 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
425 $this->waitForAjaxContent();
426 $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a");
427 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']");
428 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']");
429 $this->waitForElementPresent("_qf_Contribution_upload");
430 $this->click("_qf_Contribution_upload");
431
432 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[10]/span/a[text()='View']");
433 //click through to the Pledge view screen
434 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[10]/span/a[text()='View']");
435 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
436 $pledgeDate = date('F jS, Y', strtotime('now'));
437
438 $this->webtestVerifyTabularData(array(
439 'Pledge By' => $firstName . ' ' . $lastName,
440 'Total Pledge Amount' => '$ 30.00',
441 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
442 'Payments are due on the' => '2 day of the period',
443 'Pledge Made' => $pledgeDate,
444 'Financial Type' => 'Donation',
445 'Pledge Status' => 'Completed',
446 'Initial Reminder Day' => '4 days prior to schedule date',
447 'Maximum Reminders Send' => 2,
448 'Send additional reminders' => '4 days after the last one sent',
449 )
450 );
451 // Re-enable pop-ups to leave things in the same state
452 $this->enableDisablePopups(TRUE);
453 }
454
455 }