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