Webtests fixes
[civicrm-core.git] / tests / phpunit / WebTest / Pledge / ContactContextPledgePaymentAddTest.php
CommitLineData
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 27require_once 'CiviTest/CiviSeleniumTestCase.php';
e9479dcf
EM
28
29/**
30 * Class WebTest_Pledge_ContactContextPledgePaymentAddTest
31 */
6a488035
TO
32class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
00be9182 38 public function testAddPledgePaymentWithAdjustPledgePaymentSchedule() {
6a488035 39 $this->webtestLogin();
d2771e94 40 $this->openCiviPage('admin/setting/localization', 'reset=1');
952cc48f 41 $this->select("currencyLimit", "value=FJD");
6a488035
TO
42 $this->click("add");
43 $this->click("_qf_Localization_next-bottom");
44 $this->waitForPageToLoad($this->getTimeoutMsec());
48b420d7 45
6a488035 46 // create unique name
92915c55 47 $name = substr(sha1(rand()), 0, 7);
6a488035 48 $firstName = 'Adam' . $name;
92915c55 49 $lastName = 'Jones' . $name;
6a488035
TO
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
952cc48f
WA
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');
6a488035 60
d8d3508a 61 // wait for add pledge link
6a488035
TO
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
d2771e94 70 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
6a488035 71
6c6e6187 72 $this->select("currency", "value=FJD");
6a488035
TO
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');
481a74f4 79 $this->select("financial_type_id", "label=Donation");
6a488035
TO
80
81 $this->select("contribution_page_id", "value=3");
82
6a488035
TO
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");
45fabf8e 91 $this->waitForElementPresent('link=Add Pledge');
6a488035 92
6c5f7368 93 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
35f01dcb 94 $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035 95 //click through to the Pledge view screen
45fabf8e 96 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035
TO
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',
6a488035
TO
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
45fabf8e 114 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
e2414672 115 $this->waitForAjaxContent();
3631d941
WA
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']");
6a488035
TO
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");
e2414672 124 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
6a488035 125
45fabf8e 126 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
e2414672 127 $this->waitForAjaxContent();
751132dd 128 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
6a488035 129
3631d941
WA
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']");
6a488035
TO
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");
e2414672 138 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
6a488035 139
45fabf8e 140 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035 141 //click through to the Pledge view screen
45fabf8e 142 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035
TO
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',
6a488035
TO
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
45fabf8e 160 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
e2414672 161 $this->waitForAjaxContent();
751132dd 162 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
3631d941
WA
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']");
6a488035
TO
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");
e2414672 174 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
6a488035 175
45fabf8e 176 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
e2414672 177 $this->waitForAjaxContent();
751132dd 178 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
3631d941
WA
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']");
6a488035
TO
181
182 $this->waitForElementPresent("_qf_Contribution_upload");
183 $this->click("_qf_Contribution_upload");
e2414672 184 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
6a488035 185
c79fb98e 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']");
3631d941 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']");
6a488035
TO
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',
6a488035
TO
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 );
d2771e94 203 $this->openCiviPage('admin/setting/localization', 'reset=1');
c79fb98e 204 $this->waitForElementPresent("currencyLimit");
952cc48f 205 $this->select("currencyLimit", "value=FJD");
d2771e94
RN
206 $this->click("remove");
207 $this->click("_qf_Localization_next-bottom");
208 $this->waitForPageToLoad($this->getTimeoutMsec());
6a488035
TO
209 }
210
cd223eef 211 public function testAddPledgePaymentWithAdjustTotalPledgeAmount() {
6a488035 212 $this->webtestLogin();
d8d3508a
DG
213 // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg
214 $this->enableDisablePopups(FALSE);
6a488035
TO
215
216 // create unique name
92915c55 217 $name = substr(sha1(rand()), 0, 7);
6a488035 218 $firstName = 'Adam' . $name;
92915c55 219 $lastName = 'Jones' . $name;
6a488035
TO
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
952cc48f
WA
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');
6a488035
TO
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
d2771e94 240 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
6a488035 241
6a488035
TO
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
6a488035
TO
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");
6a488035 259
6c5f7368 260 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
6a488035 261
45fabf8e 262 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035 263 //click through to the Pledge view screen
45fabf8e 264 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035
TO
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',
6a488035
TO
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 );
45fabf8e 281 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
e2414672 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']");
6a488035
TO
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
3631d941 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']");
751132dd 294 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
3631d941 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']");
e2414672 296 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']");
6a488035
TO
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
45fabf8e 306 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035 307 //click through to the Pledge view screen
45fabf8e 308 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035
TO
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',
6a488035
TO
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
45fabf8e 326 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE);
e2414672 327 $this->waitForAjaxContent();
751132dd 328 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
3631d941
WA
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']");
6a488035
TO
331
332 $this->waitForElementPresent("_qf_Contribution_upload");
333 $this->click("_qf_Contribution_upload");
334
45fabf8e 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']");
6a488035
TO
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',
6a488035
TO
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 );
d8d3508a
DG
352 // Re-enable pop-ups to leave things in the same state
353 $this->enableDisablePopups(TRUE);
6a488035
TO
354 }
355
00be9182 356 public function testAddPledgePayment() {
6a488035
TO
357 $this->webtestLogin();
358
359 // create unique name
92915c55 360 $name = substr(sha1(rand()), 0, 7);
6a488035 361 $firstName = 'Adam' . $name;
92915c55 362 $lastName = 'Jones' . $name;
6a488035
TO
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
952cc48f
WA
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');
6a488035
TO
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
d2771e94 383 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
6a488035 384
6a488035
TO
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
6a488035
TO
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");
6a488035 402
6c5f7368 403 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
6a488035
TO
404
405 //Add payments
45fabf8e 406 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
3631d941
WA
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']");
6a488035
TO
410 $this->waitForElementPresent("_qf_Contribution_upload");
411 $this->click("_qf_Contribution_upload");
e2414672 412 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
6a488035 413
45fabf8e 414 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
e2414672 415 $this->waitForAjaxContent();
751132dd 416 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
3631d941
WA
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']");
6a488035
TO
419 $this->waitForElementPresent("_qf_Contribution_upload");
420 $this->click("_qf_Contribution_upload");
421
e2414672 422 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
45fabf8e 423 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
e2414672 424 $this->waitForAjaxContent();
751132dd 425 $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[2]/table/tbody/tr[1]/td[1]/a");
3631d941
WA
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']");
6a488035
TO
428 $this->waitForElementPresent("_qf_Contribution_upload");
429 $this->click("_qf_Contribution_upload");
430
45fabf8e 431 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035 432 //click through to the Pledge view screen
45fabf8e 433 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035
TO
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',
6a488035
TO
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 );
d8d3508a
DG
450 // Re-enable pop-ups to leave things in the same state
451 $this->enableDisablePopups(TRUE);
6a488035 452 }
96025800 453
6a488035 454}