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