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 | |
6a488035 | 46 | // create unique name |
92915c55 | 47 | $name = substr(sha1(rand()), 0, 7); |
6a488035 | 48 | $firstName = 'Adam' . $name; |
92915c55 | 49 | $lastName = 'Jones' . $name; |
6a488035 TO |
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 | |
952cc48f WA |
58 | $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']"); |
59 | $this->waitForElementPresent('crm-contact-actions-list'); | |
6a488035 | 60 | |
d8d3508a | 61 | // wait for add pledge link |
6a488035 TO |
62 | $this->waitForElementPresent('link=Add Pledge'); |
63 | ||
64 | $this->click('link=Add Pledge'); | |
65 | ||
66 | // wait for pledge form to load completely | |
67 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); | |
68 | ||
69 | // check contact name on pledge form | |
d2771e94 | 70 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
6a488035 | 71 | |
6c6e6187 | 72 | $this->select("currency", "value=FJD"); |
6a488035 TO |
73 | $this->type("amount", "30"); |
74 | $this->type("installments", "3"); | |
75 | $this->select("frequency_unit", "value=week"); | |
76 | $this->type("frequency_day", "2"); | |
77 | ||
78 | $this->webtestFillDate('acknowledge_date', 'now'); | |
481a74f4 | 79 | $this->select("financial_type_id", "label=Donation"); |
6a488035 TO |
80 | |
81 | $this->select("contribution_page_id", "value=3"); | |
82 | ||
6a488035 TO |
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."); |
35f01dcb | 94 | $this->waitForElementPresent("xpath=//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 95 | //click through to the Pledge view screen |
45fabf8e | 96 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
97 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
98 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
99 | ||
100 | $this->webtestVerifyTabularData(array( | |
101 | 'Pledge By' => $firstName . ' ' . $lastName, | |
102 | 'Total Pledge Amount' => '$ 30.00', | |
103 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
104 | 'Payments are due on the' => '2 day of the period', | |
105 | 'Pledge Made' => $pledgeDate, | |
106 | 'Financial Type' => 'Donation', | |
107 | 'Pledge Status' => 'Pending', | |
6a488035 TO |
108 | 'Initial Reminder Day' => '4 days prior to schedule date', |
109 | 'Maximum Reminders Send' => 2, | |
110 | 'Send additional reminders' => '4 days after the last one sent', | |
111 | ) | |
112 | ); | |
113 | ||
45fabf8e | 114 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
e2414672 | 115 | $this->waitForAjaxContent(); |
116 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); | |
117 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
118 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
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"); | |
e2414672 | 124 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
6a488035 | 125 | |
45fabf8e | 126 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
e2414672 | 127 | $this->waitForAjaxContent(); |
128 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[1]/a"); | |
6a488035 | 129 | |
e2414672 | 130 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
131 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/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"); | |
e2414672 | 138 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
6a488035 | 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); |
e2414672 | 161 | $this->waitForAjaxContent(); |
162 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); | |
163 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); | |
164 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
165 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
166 | ||
167 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
168 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
169 | $this->waitForElementPresent("adjust-option-type"); | |
170 | $this->type("total_amount", "10"); | |
171 | ||
172 | $this->waitForElementPresent("_qf_Contribution_upload"); | |
173 | $this->click("_qf_Contribution_upload"); | |
e2414672 | 174 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
6a488035 | 175 | |
45fabf8e | 176 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
e2414672 | 177 | $this->waitForAjaxContent(); |
178 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); | |
6a488035 | 179 | |
e2414672 | 180 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); |
181 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[5]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
182 | |
183 | $this->waitForElementPresent("_qf_Contribution_upload"); | |
184 | $this->click("_qf_Contribution_upload"); | |
e2414672 | 185 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
6a488035 | 186 | |
c79fb98e WA |
187 | $this->waitForElementPresent("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
188 | $this->click("xpath=//form[@class='CRM_Pledge_Form_Search crm-search-form']/div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); | |
6a488035 TO |
189 | |
190 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); | |
191 | $this->webtestVerifyTabularData(array( | |
192 | 'Pledge By' => $firstName . ' ' . $lastName, | |
193 | 'Total Pledge Amount' => '$ 30.00', | |
194 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
195 | 'Payments are due on the' => '2 day of the period', | |
196 | 'Pledge Made' => $pledgeDate, | |
197 | 'Financial Type' => 'Donation', | |
198 | 'Pledge Status' => 'Completed', | |
6a488035 TO |
199 | 'Initial Reminder Day' => '4 days prior to schedule date', |
200 | 'Maximum Reminders Send' => 2, | |
201 | 'Send additional reminders' => '4 days after the last one sent', | |
202 | ) | |
203 | ); | |
d2771e94 | 204 | $this->openCiviPage('admin/setting/localization', 'reset=1'); |
c79fb98e | 205 | $this->waitForElementPresent("currencyLimit"); |
952cc48f | 206 | $this->select("currencyLimit", "value=FJD"); |
d2771e94 RN |
207 | $this->click("remove"); |
208 | $this->click("_qf_Localization_next-bottom"); | |
209 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6a488035 TO |
210 | } |
211 | ||
e2414672 | 212 | public function testAdedPledgePaymentWithAdjustTotalPledgeAmount() { |
6a488035 | 213 | $this->webtestLogin(); |
d8d3508a DG |
214 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
215 | $this->enableDisablePopups(FALSE); | |
6a488035 TO |
216 | |
217 | // create unique name | |
92915c55 | 218 | $name = substr(sha1(rand()), 0, 7); |
6a488035 | 219 | $firstName = 'Adam' . $name; |
92915c55 | 220 | $lastName = 'Jones' . $name; |
6a488035 TO |
221 | |
222 | // create new contact | |
223 | $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com"); | |
224 | ||
225 | // wait for action element | |
226 | $this->waitForElementPresent('crm-contact-actions-link'); | |
227 | ||
228 | // now add pledge from contact summary | |
952cc48f WA |
229 | $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']"); |
230 | $this->waitForElementPresent('crm-contact-actions-list'); | |
6a488035 TO |
231 | |
232 | // wait for add plegde link | |
233 | $this->waitForElementPresent('link=Add Pledge'); | |
234 | ||
235 | $this->click('link=Add Pledge'); | |
236 | ||
237 | // wait for pledge form to load completely | |
238 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); | |
239 | ||
240 | // check contact name on pledge form | |
d2771e94 | 241 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
6a488035 | 242 | |
6a488035 TO |
243 | $this->type("amount", "30"); |
244 | $this->type("installments", "3"); | |
245 | $this->select("frequency_unit", "value=week"); | |
246 | $this->type("frequency_day", "2"); | |
247 | ||
248 | $this->webtestFillDate('acknowledge_date', 'now'); | |
249 | ||
250 | $this->select("contribution_page_id", "value=3"); | |
251 | ||
6a488035 TO |
252 | //PaymentReminders |
253 | $this->click("PaymentReminders"); | |
254 | $this->waitForElementPresent("additional_reminder_day"); | |
255 | $this->type("initial_reminder_day", "4"); | |
256 | $this->type("max_reminders", "2"); | |
257 | $this->type("additional_reminder_day", "4"); | |
258 | ||
259 | $this->click("_qf_Pledge_upload-bottom"); | |
6a488035 | 260 | |
6c5f7368 | 261 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 | 262 | |
45fabf8e | 263 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 264 | //click through to the Pledge view screen |
45fabf8e | 265 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
266 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
267 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
268 | ||
269 | $this->webtestVerifyTabularData(array( | |
270 | 'Pledge By' => $firstName . ' ' . $lastName, | |
271 | 'Total Pledge Amount' => '$ 30.00', | |
272 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
273 | 'Payments are due on the' => '2 day of the period', | |
274 | 'Pledge Made' => $pledgeDate, | |
275 | 'Financial Type' => 'Donation', | |
276 | 'Pledge Status' => 'Pending', | |
6a488035 TO |
277 | 'Initial Reminder Day' => '4 days prior to schedule date', |
278 | 'Maximum Reminders Send' => 2, | |
279 | 'Send additional reminders' => '4 days after the last one sent', | |
280 | ) | |
281 | ); | |
45fabf8e | 282 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
e2414672 | 283 | $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a"); |
284 | $this->waitForElementPresent("xpath=//table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
285 | $this->click("xpath=//table/tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
286 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); |
287 | $this->click("xpath=//form[@id='Contribution']//table//tbody/tr[3]/td[2]/a[text()='adjust payment amount']"); | |
288 | $this->waitForElementPresent("adjust-option-type"); | |
289 | $this->waitForElementPresent("CIVICRM_QFID_2_option_type"); | |
290 | $this->click("CIVICRM_QFID_2_option_type"); | |
291 | $this->type("total_amount", "15"); | |
292 | $this->click("_qf_Contribution_upload"); | |
293 | ||
45fabf8e | 294 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
e2414672 | 295 | $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[1]/a"); |
296 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); | |
297 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/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); |
e2414672 | 328 | $this->waitForAjaxContent(); |
329 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); | |
330 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); | |
331 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
332 | |
333 | $this->waitForElementPresent("_qf_Contribution_upload"); | |
334 | $this->click("_qf_Contribution_upload"); | |
335 | ||
45fabf8e | 336 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
337 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); | |
6a488035 TO |
338 | |
339 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); | |
340 | $this->webtestVerifyTabularData(array( | |
341 | 'Pledge By' => $firstName . ' ' . $lastName, | |
342 | 'Total Pledge Amount' => '$ 40.00', | |
343 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
344 | 'Payments are due on the' => '2 day of the period', | |
345 | 'Pledge Made' => $pledgeDate, | |
346 | 'Financial Type' => 'Donation', | |
347 | 'Pledge Status' => 'Completed', | |
6a488035 TO |
348 | 'Initial Reminder Day' => '4 days prior to schedule date', |
349 | 'Maximum Reminders Send' => 2, | |
350 | 'Send additional reminders' => '4 days after the last one sent', | |
351 | ) | |
352 | ); | |
d8d3508a DG |
353 | // Re-enable pop-ups to leave things in the same state |
354 | $this->enableDisablePopups(TRUE); | |
6a488035 TO |
355 | } |
356 | ||
00be9182 | 357 | public function testAddPledgePayment() { |
6a488035 TO |
358 | $this->webtestLogin(); |
359 | ||
360 | // create unique name | |
92915c55 | 361 | $name = substr(sha1(rand()), 0, 7); |
6a488035 | 362 | $firstName = 'Adam' . $name; |
92915c55 | 363 | $lastName = 'Jones' . $name; |
6a488035 TO |
364 | |
365 | // create new contact | |
366 | $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com"); | |
367 | ||
368 | // wait for action element | |
369 | $this->waitForElementPresent('crm-contact-actions-link'); | |
370 | ||
371 | // now add pledge from contact summary | |
952cc48f WA |
372 | $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']"); |
373 | $this->waitForElementPresent('crm-contact-actions-list'); | |
6a488035 TO |
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 | //PaymentReminders |
396 | $this->click("PaymentReminders"); | |
397 | $this->waitForElementPresent("additional_reminder_day"); | |
398 | $this->type("initial_reminder_day", "4"); | |
399 | $this->type("max_reminders", "2"); | |
400 | $this->type("additional_reminder_day", "4"); | |
401 | ||
402 | $this->click("_qf_Pledge_upload-bottom"); | |
6a488035 | 403 | |
6c5f7368 | 404 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 TO |
405 | |
406 | //Add payments | |
45fabf8e | 407 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
e2414672 | 408 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); |
409 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
410 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
411 | $this->waitForElementPresent("_qf_Contribution_upload"); |
412 | $this->click("_qf_Contribution_upload"); | |
e2414672 | 413 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
6a488035 | 414 | |
45fabf8e | 415 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
e2414672 | 416 | $this->waitForAjaxContent(); |
417 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); | |
418 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); | |
419 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
420 | $this->waitForElementPresent("_qf_Contribution_upload"); |
421 | $this->click("_qf_Contribution_upload"); | |
422 | ||
e2414672 | 423 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
45fabf8e | 424 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
e2414672 | 425 | $this->waitForAjaxContent(); |
426 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/a"); | |
427 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); | |
428 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td/div/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); | |
6a488035 TO |
429 | $this->waitForElementPresent("_qf_Contribution_upload"); |
430 | $this->click("_qf_Contribution_upload"); | |
431 | ||
45fabf8e | 432 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 | 433 | //click through to the Pledge view screen |
45fabf8e | 434 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
435 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
436 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
437 | ||
438 | $this->webtestVerifyTabularData(array( | |
439 | 'Pledge By' => $firstName . ' ' . $lastName, | |
440 | 'Total Pledge Amount' => '$ 30.00', | |
441 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', | |
442 | 'Payments are due on the' => '2 day of the period', | |
443 | 'Pledge Made' => $pledgeDate, | |
444 | 'Financial Type' => 'Donation', | |
445 | 'Pledge Status' => 'Completed', | |
6a488035 TO |
446 | 'Initial Reminder Day' => '4 days prior to schedule date', |
447 | 'Maximum Reminders Send' => 2, | |
448 | 'Send additional reminders' => '4 days after the last one sent', | |
449 | ) | |
450 | ); | |
d8d3508a DG |
451 | // Re-enable pop-ups to leave things in the same state |
452 | $this->enableDisablePopups(TRUE); | |
6a488035 | 453 | } |
96025800 | 454 | |
6a488035 | 455 | } |