Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
81621fee | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License along with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
d25dd0ee | 25 | */ |
6a488035 | 26 | |
6a488035 | 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 | ||
00be9182 | 38 | public function testAddPledgePaymentWithAdjustPledgePaymentSchedule() { |
6a488035 | 39 | $this->webtestLogin(); |
d2771e94 | 40 | $this->openCiviPage('admin/setting/localization', 'reset=1'); |
952cc48f | 41 | $this->select("currencyLimit", "value=FJD"); |
6a488035 TO |
42 | $this->click("add"); |
43 | $this->click("_qf_Localization_next-bottom"); | |
44 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
48b420d7 | 45 | |
d8d3508a DG |
46 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
47 | $this->enableDisablePopups(FALSE); | |
76e86fd8 | 48 | |
6a488035 | 49 | // create unique name |
92915c55 | 50 | $name = substr(sha1(rand()), 0, 7); |
6a488035 | 51 | $firstName = 'Adam' . $name; |
92915c55 | 52 | $lastName = 'Jones' . $name; |
6a488035 TO |
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 | |
952cc48f WA |
61 | $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']"); |
62 | $this->waitForElementPresent('crm-contact-actions-list'); | |
6a488035 | 63 | |
d8d3508a | 64 | // wait for add pledge link |
6a488035 TO |
65 | $this->waitForElementPresent('link=Add Pledge'); |
66 | ||
67 | $this->click('link=Add Pledge'); | |
68 | ||
69 | // wait for pledge form to load completely | |
70 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); | |
71 | ||
72 | // check contact name on pledge form | |
d2771e94 | 73 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
6a488035 | 74 | |
6c6e6187 | 75 | $this->select("currency", "value=FJD"); |
6a488035 TO |
76 | $this->type("amount", "30"); |
77 | $this->type("installments", "3"); | |
78 | $this->select("frequency_unit", "value=week"); | |
79 | $this->type("frequency_day", "2"); | |
80 | ||
81 | $this->webtestFillDate('acknowledge_date', 'now'); | |
481a74f4 | 82 | $this->select("financial_type_id", "label=Donation"); |
6a488035 TO |
83 | |
84 | $this->select("contribution_page_id", "value=3"); | |
85 | ||
6a488035 TO |
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."); |
35f01dcb | 97 | $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 98 | //click through to the Pledge view screen |
45fabf8e | 99 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
100 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
101 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
102 | ||
103 | $this->webtestVerifyTabularData(array( | |
104 | 'Pledge By' => $firstName . ' ' . $lastName, | |
105 | 'Total Pledge Amount' => '$ 30.00', | |
106 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
107 | 'Payments are due on the' => '2 day of the period', | |
108 | 'Pledge Made' => $pledgeDate, | |
109 | 'Financial Type' => 'Donation', | |
110 | 'Pledge Status' => 'Pending', | |
6a488035 TO |
111 | 'Initial Reminder Day' => '4 days prior to schedule date', |
112 | 'Maximum Reminders Send' => 2, | |
113 | 'Send additional reminders' => '4 days after the last one sent', | |
114 | ) | |
115 | ); | |
116 | ||
45fabf8e | 117 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
118 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
119 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
120 | $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 |
121 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
122 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
123 | $this->waitForElementPresent("adjust-option-type"); | |
124 | $this->type("total_amount", "5"); | |
125 | $this->click("_qf_Contribution_upload"); | |
126 | ||
45fabf8e | 127 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
128 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[1]/span/a"); | |
6a488035 | 129 | |
d8d3508a DG |
130 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
131 | $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 |
132 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
133 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
134 | $this->waitForElementPresent("adjust-option-type"); | |
135 | $this->type("total_amount", "10"); | |
136 | ||
137 | $this->click("_qf_Contribution_upload"); | |
138 | ||
45fabf8e | 139 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 140 | //click through to the Pledge view screen |
45fabf8e | 141 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
142 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
143 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
144 | ||
145 | $this->webtestVerifyTabularData(array( | |
146 | 'Pledge By' => $firstName . ' ' . $lastName, | |
147 | 'Total Pledge Amount' => '$ 30.00', | |
148 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
149 | 'Payments are due on the' => '2 day of the period', | |
150 | 'Pledge Made' => $pledgeDate, | |
151 | 'Financial Type' => 'Donation', | |
152 | 'Pledge Status' => 'In Progress', | |
6a488035 TO |
153 | 'Initial Reminder Day' => '4 days prior to schedule date', |
154 | 'Maximum Reminders Send' => 2, | |
155 | 'Send additional reminders' => '4 days after the last one sent', | |
156 | ) | |
157 | ); | |
158 | ||
45fabf8e | 159 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
160 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
161 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
162 | $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 |
163 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
164 | ||
165 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
166 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
167 | $this->waitForElementPresent("adjust-option-type"); | |
168 | $this->type("total_amount", "10"); | |
169 | ||
170 | $this->waitForElementPresent("_qf_Contribution_upload"); | |
171 | $this->click("_qf_Contribution_upload"); | |
172 | ||
45fabf8e | 173 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
174 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
6a488035 | 175 | |
d8d3508a DG |
176 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); |
177 | $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 |
178 | |
179 | $this->waitForElementPresent("_qf_Contribution_upload"); | |
180 | $this->click("_qf_Contribution_upload"); | |
181 | ||
45fabf8e | 182 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
183 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); | |
6a488035 TO |
184 | |
185 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); | |
186 | $this->webtestVerifyTabularData(array( | |
187 | 'Pledge By' => $firstName . ' ' . $lastName, | |
188 | 'Total Pledge Amount' => '$ 30.00', | |
189 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
190 | 'Payments are due on the' => '2 day of the period', | |
191 | 'Pledge Made' => $pledgeDate, | |
192 | 'Financial Type' => 'Donation', | |
193 | 'Pledge Status' => 'Completed', | |
6a488035 TO |
194 | 'Initial Reminder Day' => '4 days prior to schedule date', |
195 | 'Maximum Reminders Send' => 2, | |
196 | 'Send additional reminders' => '4 days after the last one sent', | |
197 | ) | |
198 | ); | |
d2771e94 | 199 | $this->openCiviPage('admin/setting/localization', 'reset=1'); |
952cc48f | 200 | $this->select("currencyLimit", "value=FJD"); |
d2771e94 RN |
201 | $this->click("remove"); |
202 | $this->click("_qf_Localization_next-bottom"); | |
203 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
d8d3508a DG |
204 | // Re-enable pop-ups to leave things in the same state |
205 | $this->enableDisablePopups(TRUE); | |
6a488035 TO |
206 | } |
207 | ||
00be9182 | 208 | public function testAddPledgePaymentWithAdjustTotalPledgeAmount() { |
6a488035 | 209 | $this->webtestLogin(); |
d8d3508a DG |
210 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
211 | $this->enableDisablePopups(FALSE); | |
6a488035 TO |
212 | |
213 | // create unique name | |
92915c55 | 214 | $name = substr(sha1(rand()), 0, 7); |
6a488035 | 215 | $firstName = 'Adam' . $name; |
92915c55 | 216 | $lastName = 'Jones' . $name; |
6a488035 TO |
217 | |
218 | // create new contact | |
219 | $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com"); | |
220 | ||
221 | // wait for action element | |
222 | $this->waitForElementPresent('crm-contact-actions-link'); | |
223 | ||
224 | // now add pledge from contact summary | |
952cc48f WA |
225 | $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']"); |
226 | $this->waitForElementPresent('crm-contact-actions-list'); | |
6a488035 TO |
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 TO |
248 | //PaymentReminders |
249 | $this->click("PaymentReminders"); | |
250 | $this->waitForElementPresent("additional_reminder_day"); | |
251 | $this->type("initial_reminder_day", "4"); | |
252 | $this->type("max_reminders", "2"); | |
253 | $this->type("additional_reminder_day", "4"); | |
254 | ||
255 | $this->click("_qf_Pledge_upload-bottom"); | |
6a488035 | 256 | |
6c5f7368 | 257 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 | 258 | |
45fabf8e | 259 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 260 | //click through to the Pledge view screen |
45fabf8e | 261 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
262 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
263 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
264 | ||
265 | $this->webtestVerifyTabularData(array( | |
266 | 'Pledge By' => $firstName . ' ' . $lastName, | |
267 | 'Total Pledge Amount' => '$ 30.00', | |
268 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
269 | 'Payments are due on the' => '2 day of the period', | |
270 | 'Pledge Made' => $pledgeDate, | |
271 | 'Financial Type' => 'Donation', | |
272 | 'Pledge Status' => 'Pending', | |
6a488035 TO |
273 | 'Initial Reminder Day' => '4 days prior to schedule date', |
274 | 'Maximum Reminders Send' => 2, | |
275 | 'Send additional reminders' => '4 days after the last one sent', | |
276 | ) | |
277 | ); | |
45fabf8e | 278 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
3c926399 WA |
279 | $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/span/a"); |
280 | $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
281 | $this->click("xpath=//table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
282 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
283 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
284 | $this->waitForElementPresent("adjust-option-type"); | |
285 | $this->waitForElementPresent("CIVICRM_QFID_2_option_type"); | |
286 | $this->click("CIVICRM_QFID_2_option_type"); | |
287 | $this->type("total_amount", "15"); | |
288 | $this->click("_qf_Contribution_upload"); | |
289 | ||
45fabf8e | 290 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
291 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
6a488035 | 292 | |
d8d3508a DG |
293 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
294 | $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 |
295 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
296 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
297 | $this->waitForElementPresent("adjust-option-type"); | |
298 | $this->waitForElementPresent("CIVICRM_QFID_2_option_type"); | |
299 | $this->click("CIVICRM_QFID_2_option_type"); | |
300 | $this->type("total_amount", "15"); | |
301 | ||
302 | $this->click("_qf_Contribution_upload"); | |
303 | ||
45fabf8e | 304 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 305 | //click through to the Pledge view screen |
45fabf8e | 306 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
307 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
308 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
309 | ||
310 | $this->webtestVerifyTabularData(array( | |
311 | 'Pledge By' => $firstName . ' ' . $lastName, | |
312 | 'Total Pledge Amount' => '$ 40.00', | |
313 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
314 | 'Payments are due on the' => '2 day of the period', | |
315 | 'Pledge Made' => $pledgeDate, | |
316 | 'Financial Type' => 'Donation', | |
317 | 'Pledge Status' => 'In Progress', | |
6a488035 TO |
318 | 'Initial Reminder Day' => '4 days prior to schedule date', |
319 | 'Maximum Reminders Send' => 2, | |
320 | 'Send additional reminders' => '4 days after the last one sent', | |
321 | ) | |
322 | ); | |
323 | ||
45fabf8e | 324 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
325 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
326 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
327 | $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 |
328 | |
329 | $this->waitForElementPresent("_qf_Contribution_upload"); | |
330 | $this->click("_qf_Contribution_upload"); | |
331 | ||
45fabf8e | 332 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
333 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); | |
6a488035 TO |
334 | |
335 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); | |
336 | $this->webtestVerifyTabularData(array( | |
337 | 'Pledge By' => $firstName . ' ' . $lastName, | |
338 | 'Total Pledge Amount' => '$ 40.00', | |
339 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
340 | 'Payments are due on the' => '2 day of the period', | |
341 | 'Pledge Made' => $pledgeDate, | |
342 | 'Financial Type' => 'Donation', | |
343 | 'Pledge Status' => 'Completed', | |
6a488035 TO |
344 | 'Initial Reminder Day' => '4 days prior to schedule date', |
345 | 'Maximum Reminders Send' => 2, | |
346 | 'Send additional reminders' => '4 days after the last one sent', | |
347 | ) | |
348 | ); | |
d8d3508a DG |
349 | // Re-enable pop-ups to leave things in the same state |
350 | $this->enableDisablePopups(TRUE); | |
6a488035 TO |
351 | } |
352 | ||
00be9182 | 353 | public function testAddPledgePayment() { |
6a488035 | 354 | $this->webtestLogin(); |
d8d3508a DG |
355 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
356 | $this->enableDisablePopups(FALSE); | |
6a488035 TO |
357 | |
358 | // create unique name | |
92915c55 | 359 | $name = substr(sha1(rand()), 0, 7); |
6a488035 | 360 | $firstName = 'Adam' . $name; |
92915c55 | 361 | $lastName = 'Jones' . $name; |
6a488035 TO |
362 | |
363 | // create new contact | |
364 | $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com"); | |
365 | ||
366 | // wait for action element | |
367 | $this->waitForElementPresent('crm-contact-actions-link'); | |
368 | ||
369 | // now add pledge from contact summary | |
952cc48f WA |
370 | $this->click("xpath=//div[@class='crm-actions-ribbon']/ul[@id='actions']/li[@class='crm-contact-activity crm-summary-block']/div/a[@id='crm-contact-actions-link']"); |
371 | $this->waitForElementPresent('crm-contact-actions-list'); | |
6a488035 TO |
372 | |
373 | // wait for add plegde link | |
374 | $this->waitForElementPresent('link=Add Pledge'); | |
375 | ||
376 | $this->click('link=Add Pledge'); | |
377 | ||
378 | // wait for pledge form to load completely | |
379 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); | |
380 | ||
381 | // check contact name on pledge form | |
d2771e94 | 382 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
6a488035 | 383 | |
6a488035 TO |
384 | $this->type("amount", "30"); |
385 | $this->type("installments", "3"); | |
386 | $this->select("frequency_unit", "value=week"); | |
387 | $this->type("frequency_day", "2"); | |
388 | ||
389 | $this->webtestFillDate('acknowledge_date', 'now'); | |
390 | ||
391 | $this->select("contribution_page_id", "value=3"); | |
392 | ||
6a488035 TO |
393 | //PaymentReminders |
394 | $this->click("PaymentReminders"); | |
395 | $this->waitForElementPresent("additional_reminder_day"); | |
396 | $this->type("initial_reminder_day", "4"); | |
397 | $this->type("max_reminders", "2"); | |
398 | $this->type("additional_reminder_day", "4"); | |
399 | ||
400 | $this->click("_qf_Pledge_upload-bottom"); | |
6a488035 | 401 | |
6c5f7368 | 402 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 TO |
403 | |
404 | //Add payments | |
45fabf8e | 405 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
406 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
407 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
408 | $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 |
409 | $this->waitForElementPresent("_qf_Contribution_upload"); |
410 | $this->click("_qf_Contribution_upload"); | |
411 | ||
45fabf8e | 412 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
413 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
414 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
415 | $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 |
416 | $this->waitForElementPresent("_qf_Contribution_upload"); |
417 | $this->click("_qf_Contribution_upload"); | |
418 | ||
45fabf8e | 419 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
420 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
d8d3508a DG |
421 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
422 | $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 |
423 | $this->waitForElementPresent("_qf_Contribution_upload"); |
424 | $this->click("_qf_Contribution_upload"); | |
425 | ||
45fabf8e | 426 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 427 | //click through to the Pledge view screen |
45fabf8e | 428 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
429 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
430 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
431 | ||
432 | $this->webtestVerifyTabularData(array( | |
433 | 'Pledge By' => $firstName . ' ' . $lastName, | |
434 | 'Total Pledge Amount' => '$ 30.00', | |
435 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
436 | 'Payments are due on the' => '2 day of the period', | |
437 | 'Pledge Made' => $pledgeDate, | |
438 | 'Financial Type' => 'Donation', | |
439 | 'Pledge Status' => 'Completed', | |
6a488035 TO |
440 | 'Initial Reminder Day' => '4 days prior to schedule date', |
441 | 'Maximum Reminders Send' => 2, | |
442 | 'Send additional reminders' => '4 days after the last one sent', | |
443 | ) | |
444 | ); | |
d8d3508a DG |
445 | // Re-enable pop-ups to leave things in the same state |
446 | $this->enableDisablePopups(TRUE); | |
6a488035 | 447 | } |
96025800 | 448 | |
6a488035 | 449 | } |