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()); | |
d8d3508a DG |
45 | |
46 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg | |
47 | $this->enableDisablePopups(FALSE); | |
76e86fd8 | 48 | |
6a488035 TO |
49 | // create unique name |
50 | $name = substr(sha1(rand()), 0, 7); | |
51 | $firstName = 'Adam' . $name; | |
52 | $lastName = 'Jones' . $name; | |
53 | ||
54 | // create new contact | |
55 | $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com"); | |
56 | ||
57 | // wait for action element | |
58 | $this->waitForElementPresent('crm-contact-actions-link'); | |
59 | ||
60 | // now add pledge from contact summary | |
61 | $this->click("//a[@id='crm-contact-actions-link']/span/div"); | |
62 | ||
d8d3508a | 63 | // wait for add pledge link |
6a488035 TO |
64 | $this->waitForElementPresent('link=Add Pledge'); |
65 | ||
66 | $this->click('link=Add Pledge'); | |
67 | ||
68 | // wait for pledge form to load completely | |
69 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); | |
70 | ||
71 | // check contact name on pledge form | |
d2771e94 | 72 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
6a488035 | 73 | |
6a488035 TO |
74 | $this->select("currency","value=FJD"); |
75 | $this->type("amount", "30"); | |
76 | $this->type("installments", "3"); | |
77 | $this->select("frequency_unit", "value=week"); | |
78 | $this->type("frequency_day", "2"); | |
79 | ||
80 | $this->webtestFillDate('acknowledge_date', 'now'); | |
81 | $this->select( "financial_type_id", "label=Donation"); | |
82 | ||
83 | $this->select("contribution_page_id", "value=3"); | |
84 | ||
6a488035 TO |
85 | |
86 | //PaymentReminders | |
87 | $this->click("PaymentReminders"); | |
88 | $this->waitForElementPresent("additional_reminder_day"); | |
89 | $this->type("initial_reminder_day", "4"); | |
90 | $this->type("max_reminders", "2"); | |
91 | $this->type("additional_reminder_day", "4"); | |
92 | ||
93 | $this->click("_qf_Pledge_upload-bottom"); | |
45fabf8e | 94 | $this->waitForElementPresent('link=Add Pledge'); |
6a488035 | 95 | |
6c5f7368 | 96 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 | 97 | |
45fabf8e | 98 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 99 | //click through to the Pledge view screen |
45fabf8e | 100 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
101 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
102 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
103 | ||
104 | $this->webtestVerifyTabularData(array( | |
105 | 'Pledge By' => $firstName . ' ' . $lastName, | |
106 | 'Total Pledge Amount' => '$ 30.00', | |
107 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
108 | 'Payments are due on the' => '2 day of the period', | |
109 | 'Pledge Made' => $pledgeDate, | |
110 | 'Financial Type' => 'Donation', | |
111 | 'Pledge Status' => 'Pending', | |
6a488035 TO |
112 | 'Initial Reminder Day' => '4 days prior to schedule date', |
113 | 'Maximum Reminders Send' => 2, | |
114 | 'Send additional reminders' => '4 days after the last one sent', | |
115 | ) | |
116 | ); | |
117 | ||
45fabf8e | 118 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
119 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
120 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
121 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
122 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
123 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
124 | $this->waitForElementPresent("adjust-option-type"); | |
125 | $this->type("total_amount", "5"); | |
126 | $this->click("_qf_Contribution_upload"); | |
127 | ||
45fabf8e | 128 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
129 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[1]/span/a"); | |
6a488035 | 130 | |
d8d3508a DG |
131 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
132 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
133 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
134 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
135 | $this->waitForElementPresent("adjust-option-type"); | |
136 | $this->type("total_amount", "10"); | |
137 | ||
138 | $this->click("_qf_Contribution_upload"); | |
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); |
161 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
162 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
163 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
164 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
165 | ||
166 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
167 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
168 | $this->waitForElementPresent("adjust-option-type"); | |
169 | $this->type("total_amount", "10"); | |
170 | ||
171 | $this->waitForElementPresent("_qf_Contribution_upload"); | |
172 | $this->click("_qf_Contribution_upload"); | |
173 | ||
45fabf8e | 174 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
175 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
6a488035 | 176 | |
d8d3508a DG |
177 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); |
178 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
179 | |
180 | $this->waitForElementPresent("_qf_Contribution_upload"); | |
181 | $this->click("_qf_Contribution_upload"); | |
182 | ||
45fabf8e | 183 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
184 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); | |
6a488035 TO |
185 | |
186 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); | |
187 | $this->webtestVerifyTabularData(array( | |
188 | 'Pledge By' => $firstName . ' ' . $lastName, | |
189 | 'Total Pledge Amount' => '$ 30.00', | |
190 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
191 | 'Payments are due on the' => '2 day of the period', | |
192 | 'Pledge Made' => $pledgeDate, | |
193 | 'Financial Type' => 'Donation', | |
194 | 'Pledge Status' => 'Completed', | |
6a488035 TO |
195 | 'Initial Reminder Day' => '4 days prior to schedule date', |
196 | 'Maximum Reminders Send' => 2, | |
197 | 'Send additional reminders' => '4 days after the last one sent', | |
198 | ) | |
199 | ); | |
d2771e94 RN |
200 | $this->openCiviPage('admin/setting/localization', 'reset=1'); |
201 | $this->select("currencyLimit-t","value=FJD"); | |
202 | $this->click("remove"); | |
203 | $this->click("_qf_Localization_next-bottom"); | |
204 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
d8d3508a DG |
205 | // Re-enable pop-ups to leave things in the same state |
206 | $this->enableDisablePopups(TRUE); | |
6a488035 TO |
207 | } |
208 | ||
209 | function testAddPledgePaymentWithAdjustTotalPledgeAmount() { | |
6a488035 | 210 | $this->webtestLogin(); |
d8d3508a DG |
211 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
212 | $this->enableDisablePopups(FALSE); | |
6a488035 TO |
213 | |
214 | // create unique name | |
215 | $name = substr(sha1(rand()), 0, 7); | |
216 | $firstName = 'Adam' . $name; | |
217 | $lastName = 'Jones' . $name; | |
218 | ||
219 | // create new contact | |
220 | $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com"); | |
221 | ||
222 | // wait for action element | |
223 | $this->waitForElementPresent('crm-contact-actions-link'); | |
224 | ||
225 | // now add pledge from contact summary | |
226 | $this->click("//a[@id='crm-contact-actions-link']/span/div"); | |
227 | ||
228 | // wait for add plegde link | |
229 | $this->waitForElementPresent('link=Add Pledge'); | |
230 | ||
231 | $this->click('link=Add Pledge'); | |
232 | ||
233 | // wait for pledge form to load completely | |
234 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); | |
235 | ||
236 | // check contact name on pledge form | |
d2771e94 | 237 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
6a488035 | 238 | |
6a488035 TO |
239 | $this->type("amount", "30"); |
240 | $this->type("installments", "3"); | |
241 | $this->select("frequency_unit", "value=week"); | |
242 | $this->type("frequency_day", "2"); | |
243 | ||
244 | $this->webtestFillDate('acknowledge_date', 'now'); | |
245 | ||
246 | $this->select("contribution_page_id", "value=3"); | |
247 | ||
6a488035 | 248 | |
6a488035 TO |
249 | |
250 | //PaymentReminders | |
251 | $this->click("PaymentReminders"); | |
252 | $this->waitForElementPresent("additional_reminder_day"); | |
253 | $this->type("initial_reminder_day", "4"); | |
254 | $this->type("max_reminders", "2"); | |
255 | $this->type("additional_reminder_day", "4"); | |
256 | ||
257 | $this->click("_qf_Pledge_upload-bottom"); | |
6a488035 | 258 | |
6c5f7368 | 259 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 | 260 | |
45fabf8e | 261 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 262 | //click through to the Pledge view screen |
45fabf8e | 263 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
264 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
265 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
266 | ||
267 | $this->webtestVerifyTabularData(array( | |
268 | 'Pledge By' => $firstName . ' ' . $lastName, | |
269 | 'Total Pledge Amount' => '$ 30.00', | |
270 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
271 | 'Payments are due on the' => '2 day of the period', | |
272 | 'Pledge Made' => $pledgeDate, | |
273 | 'Financial Type' => 'Donation', | |
274 | 'Pledge Status' => 'Pending', | |
6a488035 TO |
275 | 'Initial Reminder Day' => '4 days prior to schedule date', |
276 | 'Maximum Reminders Send' => 2, | |
277 | 'Send additional reminders' => '4 days after the last one sent', | |
278 | ) | |
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); |
282 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
283 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
284 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/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 | ||
45fabf8e | 293 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
294 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
6a488035 | 295 | |
d8d3508a DG |
296 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
297 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
298 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
299 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
300 | $this->waitForElementPresent("adjust-option-type"); | |
301 | $this->waitForElementPresent("CIVICRM_QFID_2_option_type"); | |
302 | $this->click("CIVICRM_QFID_2_option_type"); | |
303 | $this->type("total_amount", "15"); | |
304 | ||
305 | $this->click("_qf_Contribution_upload"); | |
306 | ||
45fabf8e | 307 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 308 | //click through to the Pledge view screen |
45fabf8e | 309 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
310 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
311 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
312 | ||
313 | $this->webtestVerifyTabularData(array( | |
314 | 'Pledge By' => $firstName . ' ' . $lastName, | |
315 | 'Total Pledge Amount' => '$ 40.00', | |
316 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
317 | 'Payments are due on the' => '2 day of the period', | |
318 | 'Pledge Made' => $pledgeDate, | |
319 | 'Financial Type' => 'Donation', | |
320 | 'Pledge Status' => 'In Progress', | |
6a488035 TO |
321 | 'Initial Reminder Day' => '4 days prior to schedule date', |
322 | 'Maximum Reminders Send' => 2, | |
323 | 'Send additional reminders' => '4 days after the last one sent', | |
324 | ) | |
325 | ); | |
326 | ||
45fabf8e | 327 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
328 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
329 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
330 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/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 | ||
356 | function testAddPledgePayment() { | |
6a488035 | 357 | $this->webtestLogin(); |
d8d3508a DG |
358 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
359 | $this->enableDisablePopups(FALSE); | |
6a488035 TO |
360 | |
361 | // create unique name | |
362 | $name = substr(sha1(rand()), 0, 7); | |
363 | $firstName = 'Adam' . $name; | |
364 | $lastName = 'Jones' . $name; | |
365 | ||
366 | // create new contact | |
367 | $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com"); | |
368 | ||
369 | // wait for action element | |
370 | $this->waitForElementPresent('crm-contact-actions-link'); | |
371 | ||
372 | // now add pledge from contact summary | |
373 | $this->click("//a[@id='crm-contact-actions-link']/span/div"); | |
374 | ||
375 | // wait for add plegde link | |
376 | $this->waitForElementPresent('link=Add Pledge'); | |
377 | ||
378 | $this->click('link=Add Pledge'); | |
379 | ||
380 | // wait for pledge form to load completely | |
381 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); | |
382 | ||
383 | // check contact name on pledge form | |
d2771e94 | 384 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
6a488035 | 385 | |
6a488035 TO |
386 | $this->type("amount", "30"); |
387 | $this->type("installments", "3"); | |
388 | $this->select("frequency_unit", "value=week"); | |
389 | $this->type("frequency_day", "2"); | |
390 | ||
391 | $this->webtestFillDate('acknowledge_date', 'now'); | |
392 | ||
393 | $this->select("contribution_page_id", "value=3"); | |
394 | ||
6a488035 TO |
395 | |
396 | //PaymentReminders | |
397 | $this->click("PaymentReminders"); | |
398 | $this->waitForElementPresent("additional_reminder_day"); | |
399 | $this->type("initial_reminder_day", "4"); | |
400 | $this->type("max_reminders", "2"); | |
401 | $this->type("additional_reminder_day", "4"); | |
402 | ||
403 | $this->click("_qf_Pledge_upload-bottom"); | |
6a488035 | 404 | |
6c5f7368 | 405 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 TO |
406 | |
407 | //Add payments | |
45fabf8e | 408 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
409 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
410 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
411 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
412 | $this->waitForElementPresent("_qf_Contribution_upload"); |
413 | $this->click("_qf_Contribution_upload"); | |
414 | ||
45fabf8e | 415 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
416 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
417 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
418 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/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 | ||
45fabf8e | 422 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
423 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
424 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
425 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
426 | $this->waitForElementPresent("_qf_Contribution_upload"); |
427 | $this->click("_qf_Contribution_upload"); | |
428 | ||
45fabf8e | 429 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 430 | //click through to the Pledge view screen |
45fabf8e | 431 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
432 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
433 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
434 | ||
435 | $this->webtestVerifyTabularData(array( | |
436 | 'Pledge By' => $firstName . ' ' . $lastName, | |
437 | 'Total Pledge Amount' => '$ 30.00', | |
438 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
439 | 'Payments are due on the' => '2 day of the period', | |
440 | 'Pledge Made' => $pledgeDate, | |
441 | 'Financial Type' => 'Donation', | |
442 | 'Pledge Status' => 'Completed', | |
6a488035 TO |
443 | 'Initial Reminder Day' => '4 days prior to schedule date', |
444 | 'Maximum Reminders Send' => 2, | |
445 | 'Send additional reminders' => '4 days after the last one sent', | |
446 | ) | |
447 | ); | |
d8d3508a DG |
448 | // Re-enable pop-ups to leave things in the same state |
449 | $this->enableDisablePopups(TRUE); | |
6a488035 TO |
450 | } |
451 | } | |
452 |