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