d883eec0d27e347e3e9bcbe76bdb67328533f849
[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-2015 |
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=//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']");
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=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
179 $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']");
180 $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']");
181
182 $this->waitForElementPresent("_qf_Contribution_upload");
183 $this->click("_qf_Contribution_upload");
184 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
185
186 $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']");
187 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[10]/span/a[text()='View']");
188
189 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
190 $this->webtestVerifyTabularData(array(
191 'Pledge By' => $firstName . ' ' . $lastName,
192 'Total Pledge Amount' => '$ 30.00',
193 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
194 'Payments are due on the' => '2 day of the period',
195 'Pledge Made' => $pledgeDate,
196 'Financial Type' => 'Donation',
197 'Pledge Status' => 'Completed',
198 'Initial Reminder Day' => '4 days prior to schedule date',
199 'Maximum Reminders Send' => 2,
200 'Send additional reminders' => '4 days after the last one sent',
201 )
202 );
203 $this->openCiviPage('admin/setting/localization', 'reset=1');
204 $this->waitForElementPresent("currencyLimit");
205 $this->select("currencyLimit", "value=FJD");
206 $this->click("remove");
207 $this->click("_qf_Localization_next-bottom");
208 $this->waitForPageToLoad($this->getTimeoutMsec());
209 }
210
211 public function testAddPledgePaymentWithAdjustTotalPledgeAmount() {
212 $this->webtestLogin();
213 // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg
214 $this->enableDisablePopups(FALSE);
215
216 // create unique name
217 $name = substr(sha1(rand()), 0, 7);
218 $firstName = 'Adam' . $name;
219 $lastName = 'Jones' . $name;
220
221 // create new contact
222 $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com");
223
224 // wait for action element
225 $this->waitForElementPresent('crm-contact-actions-link');
226
227 // now add pledge from contact summary
228 $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']");
229 $this->waitForElementPresent('crm-contact-actions-list');
230
231 // wait for add plegde link
232 $this->waitForElementPresent('link=Add Pledge');
233
234 $this->click('link=Add Pledge');
235
236 // wait for pledge form to load completely
237 $this->waitForElementPresent('_qf_Pledge_upload-bottom');
238
239 // check contact name on pledge form
240 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
241
242 $this->type("amount", "30");
243 $this->type("installments", "3");
244 $this->select("frequency_unit", "value=week");
245 $this->type("frequency_day", "2");
246
247 $this->webtestFillDate('acknowledge_date', 'now');
248
249 $this->select("contribution_page_id", "value=3");
250
251 //PaymentReminders
252 $this->click("PaymentReminders");
253 $this->waitForElementPresent("additional_reminder_day");
254 $this->type("initial_reminder_day", "4");
255 $this->type("max_reminders", "2");
256 $this->type("additional_reminder_day", "4");
257
258 $this->click("_qf_Pledge_upload-bottom");
259
260 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
261
262 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
263 //click through to the Pledge view screen
264 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
265 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
266 $pledgeDate = date('F jS, Y', strtotime('now'));
267
268 $this->webtestVerifyTabularData(array(
269 'Pledge By' => $firstName . ' ' . $lastName,
270 'Total Pledge Amount' => '$ 30.00',
271 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
272 'Payments are due on the' => '2 day of the period',
273 'Pledge Made' => $pledgeDate,
274 'Financial Type' => 'Donation',
275 'Pledge Status' => 'Pending',
276 'Initial Reminder Day' => '4 days prior to schedule date',
277 'Maximum Reminders Send' => 2,
278 'Send additional reminders' => '4 days after the last one sent',
279 )
280 );
281 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
282 $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a");
283 $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
284 $this->click("xpath=//table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
285 $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
286 $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
287 $this->waitForElementPresent("adjust-option-type");
288 $this->waitForElementPresent("CIVICRM_QFID_2_option_type");
289 $this->click("CIVICRM_QFID_2_option_type");
290 $this->type("total_amount", "15");
291 $this->click("_qf_Contribution_upload");
292
293 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[10]/span/a[text()='View']");
294 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
295 $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']");
296 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']");
297 $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
298 $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']");
299 $this->waitForElementPresent("adjust-option-type");
300 $this->waitForElementPresent("CIVICRM_QFID_2_option_type");
301 $this->click("CIVICRM_QFID_2_option_type");
302 $this->type("total_amount", "15");
303
304 $this->click("_qf_Contribution_upload");
305
306 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
307 //click through to the Pledge view screen
308 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
309 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
310 $pledgeDate = date('F jS, Y', strtotime('now'));
311
312 $this->webtestVerifyTabularData(array(
313 'Pledge By' => $firstName . ' ' . $lastName,
314 'Total Pledge Amount' => '$ 40.00',
315 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
316 'Payments are due on the' => '2 day of the period',
317 'Pledge Made' => $pledgeDate,
318 'Financial Type' => 'Donation',
319 'Pledge Status' => 'In Progress',
320 'Initial Reminder Day' => '4 days prior to schedule date',
321 'Maximum Reminders Send' => 2,
322 'Send additional reminders' => '4 days after the last one sent',
323 )
324 );
325
326 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
327 $this->waitForAjaxContent();
328 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
329 $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']");
330 $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']");
331
332 $this->waitForElementPresent("_qf_Contribution_upload");
333 $this->click("_qf_Contribution_upload");
334
335 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
336 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
337
338 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
339 $this->webtestVerifyTabularData(array(
340 'Pledge By' => $firstName . ' ' . $lastName,
341 'Total Pledge Amount' => '$ 40.00',
342 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
343 'Payments are due on the' => '2 day of the period',
344 'Pledge Made' => $pledgeDate,
345 'Financial Type' => 'Donation',
346 'Pledge Status' => 'Completed',
347 'Initial Reminder Day' => '4 days prior to schedule date',
348 'Maximum Reminders Send' => 2,
349 'Send additional reminders' => '4 days after the last one sent',
350 )
351 );
352 // Re-enable pop-ups to leave things in the same state
353 $this->enableDisablePopups(TRUE);
354 }
355
356 public function testAddPledgePayment() {
357 $this->webtestLogin();
358
359 // create unique name
360 $name = substr(sha1(rand()), 0, 7);
361 $firstName = 'Adam' . $name;
362 $lastName = 'Jones' . $name;
363
364 // create new contact
365 $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com");
366
367 // wait for action element
368 $this->waitForElementPresent('crm-contact-actions-link');
369
370 // now add pledge from contact summary
371 $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']");
372 $this->waitForElementPresent('crm-contact-actions-list');
373
374 // wait for add plegde link
375 $this->waitForElementPresent('link=Add Pledge');
376
377 $this->click('link=Add Pledge');
378
379 // wait for pledge form to load completely
380 $this->waitForElementPresent('_qf_Pledge_upload-bottom');
381
382 // check contact name on pledge form
383 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
384
385 $this->type("amount", "30");
386 $this->type("installments", "3");
387 $this->select("frequency_unit", "value=week");
388 $this->type("frequency_day", "2");
389
390 $this->webtestFillDate('acknowledge_date', 'now');
391
392 $this->select("contribution_page_id", "value=3");
393
394 //PaymentReminders
395 $this->click("PaymentReminders");
396 $this->waitForElementPresent("additional_reminder_day");
397 $this->type("initial_reminder_day", "4");
398 $this->type("max_reminders", "2");
399 $this->type("additional_reminder_day", "4");
400
401 $this->click("_qf_Pledge_upload-bottom");
402
403 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
404
405 //Add payments
406 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
407 $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");
408 $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']");
409 $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']");
410 $this->waitForElementPresent("_qf_Contribution_upload");
411 $this->click("_qf_Contribution_upload");
412 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
413
414 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
415 $this->waitForAjaxContent();
416 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
417 $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']");
418 $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']");
419 $this->waitForElementPresent("_qf_Contribution_upload");
420 $this->click("_qf_Contribution_upload");
421
422 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
423 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
424 $this->waitForAjaxContent();
425 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
426 $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']");
427 $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']");
428 $this->waitForElementPresent("_qf_Contribution_upload");
429 $this->click("_qf_Contribution_upload");
430
431 $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[10]/span/a[text()='View']");
432 //click through to the Pledge view screen
433 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[10]/span/a[text()='View']");
434 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
435 $pledgeDate = date('F jS, Y', strtotime('now'));
436
437 $this->webtestVerifyTabularData(array(
438 'Pledge By' => $firstName . ' ' . $lastName,
439 'Total Pledge Amount' => '$ 30.00',
440 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)',
441 'Payments are due on the' => '2 day of the period',
442 'Pledge Made' => $pledgeDate,
443 'Financial Type' => 'Donation',
444 'Pledge Status' => 'Completed',
445 'Initial Reminder Day' => '4 days prior to schedule date',
446 'Maximum Reminders Send' => 2,
447 'Send additional reminders' => '4 days after the last one sent',
448 )
449 );
450 // Re-enable pop-ups to leave things in the same state
451 $this->enableDisablePopups(TRUE);
452 }
453
454 }