| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | CiviCRM version 4.7 | |
| 5 | +--------------------------------------------------------------------+ |
| 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
| 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 | |
| 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
| 28 | |
| 29 | /** |
| 30 | * Class WebTest_Pledge_ContactContextPledgePaymentAddTest |
| 31 | */ |
| 32 | class WebTest_Pledge_ContactContextPledgePaymentAddTest extends CiviSeleniumTestCase { |
| 33 | |
| 34 | protected function setUp() { |
| 35 | parent::setUp(); |
| 36 | } |
| 37 | |
| 38 | public function testAddPledgePaymentWithAdjustPledgePaymentSchedule() { |
| 39 | $this->webtestLogin(); |
| 40 | $this->openCiviPage('admin/setting/localization', 'reset=1'); |
| 41 | $this->select("currencyLimit-f", "value=FJD"); |
| 42 | $this->click("add"); |
| 43 | $this->click("_qf_Localization_next-bottom"); |
| 44 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
| 45 | |
| 46 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
| 47 | $this->enableDisablePopups(FALSE); |
| 48 | |
| 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 | |
| 63 | // wait for add pledge link |
| 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 |
| 72 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
| 73 | |
| 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 | |
| 85 | //PaymentReminders |
| 86 | $this->click("PaymentReminders"); |
| 87 | $this->waitForElementPresent("additional_reminder_day"); |
| 88 | $this->type("initial_reminder_day", "4"); |
| 89 | $this->type("max_reminders", "2"); |
| 90 | $this->type("additional_reminder_day", "4"); |
| 91 | |
| 92 | $this->click("_qf_Pledge_upload-bottom"); |
| 93 | $this->waitForElementPresent('link=Add Pledge'); |
| 94 | |
| 95 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
| 96 | |
| 97 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 98 | //click through to the Pledge view screen |
| 99 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 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', |
| 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 | |
| 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"); |
| 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']"); |
| 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 | |
| 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"); |
| 129 | |
| 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']"); |
| 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 | |
| 139 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 140 | //click through to the Pledge view screen |
| 141 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 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', |
| 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 | |
| 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"); |
| 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']"); |
| 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 | |
| 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"); |
| 175 | |
| 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']"); |
| 178 | |
| 179 | $this->waitForElementPresent("_qf_Contribution_upload"); |
| 180 | $this->click("_qf_Contribution_upload"); |
| 181 | |
| 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']"); |
| 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', |
| 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 | ); |
| 199 | $this->openCiviPage('admin/setting/localization', 'reset=1'); |
| 200 | $this->select("currencyLimit-t", "value=FJD"); |
| 201 | $this->click("remove"); |
| 202 | $this->click("_qf_Localization_next-bottom"); |
| 203 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
| 204 | // Re-enable pop-ups to leave things in the same state |
| 205 | $this->enableDisablePopups(TRUE); |
| 206 | } |
| 207 | |
| 208 | public function testAddPledgePaymentWithAdjustTotalPledgeAmount() { |
| 209 | $this->webtestLogin(); |
| 210 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
| 211 | $this->enableDisablePopups(FALSE); |
| 212 | |
| 213 | // create unique name |
| 214 | $name = substr(sha1(rand()), 0, 7); |
| 215 | $firstName = 'Adam' . $name; |
| 216 | $lastName = 'Jones' . $name; |
| 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 |
| 225 | $this->click("//a[@id='crm-contact-actions-link']/span/div"); |
| 226 | |
| 227 | // wait for add plegde link |
| 228 | $this->waitForElementPresent('link=Add Pledge'); |
| 229 | |
| 230 | $this->click('link=Add Pledge'); |
| 231 | |
| 232 | // wait for pledge form to load completely |
| 233 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); |
| 234 | |
| 235 | // check contact name on pledge form |
| 236 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
| 237 | |
| 238 | $this->type("amount", "30"); |
| 239 | $this->type("installments", "3"); |
| 240 | $this->select("frequency_unit", "value=week"); |
| 241 | $this->type("frequency_day", "2"); |
| 242 | |
| 243 | $this->webtestFillDate('acknowledge_date', 'now'); |
| 244 | |
| 245 | $this->select("contribution_page_id", "value=3"); |
| 246 | |
| 247 | //PaymentReminders |
| 248 | $this->click("PaymentReminders"); |
| 249 | $this->waitForElementPresent("additional_reminder_day"); |
| 250 | $this->type("initial_reminder_day", "4"); |
| 251 | $this->type("max_reminders", "2"); |
| 252 | $this->type("additional_reminder_day", "4"); |
| 253 | |
| 254 | $this->click("_qf_Pledge_upload-bottom"); |
| 255 | |
| 256 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
| 257 | |
| 258 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 259 | //click through to the Pledge view screen |
| 260 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 261 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
| 262 | $pledgeDate = date('F jS, Y', strtotime('now')); |
| 263 | |
| 264 | $this->webtestVerifyTabularData(array( |
| 265 | 'Pledge By' => $firstName . ' ' . $lastName, |
| 266 | 'Total Pledge Amount' => '$ 30.00', |
| 267 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', |
| 268 | 'Payments are due on the' => '2 day of the period', |
| 269 | 'Pledge Made' => $pledgeDate, |
| 270 | 'Financial Type' => 'Donation', |
| 271 | 'Pledge Status' => 'Pending', |
| 272 | 'Initial Reminder Day' => '4 days prior to schedule date', |
| 273 | 'Maximum Reminders Send' => 2, |
| 274 | 'Send additional reminders' => '4 days after the last one sent', |
| 275 | ) |
| 276 | ); |
| 277 | |
| 278 | $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']", FALSE); |
| 279 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
| 280 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
| 281 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
| 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 | |
| 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"); |
| 292 | |
| 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']"); |
| 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 | |
| 304 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 305 | //click through to the Pledge view screen |
| 306 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 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', |
| 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 | |
| 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"); |
| 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']"); |
| 328 | |
| 329 | $this->waitForElementPresent("_qf_Contribution_upload"); |
| 330 | $this->click("_qf_Contribution_upload"); |
| 331 | |
| 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']"); |
| 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', |
| 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 | ); |
| 349 | // Re-enable pop-ups to leave things in the same state |
| 350 | $this->enableDisablePopups(TRUE); |
| 351 | } |
| 352 | |
| 353 | public function testAddPledgePayment() { |
| 354 | $this->webtestLogin(); |
| 355 | // Disable pop-ups for this test. Running test w/ pop-ups causes a spurious failure. dgg |
| 356 | $this->enableDisablePopups(FALSE); |
| 357 | |
| 358 | // create unique name |
| 359 | $name = substr(sha1(rand()), 0, 7); |
| 360 | $firstName = 'Adam' . $name; |
| 361 | $lastName = 'Jones' . $name; |
| 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 |
| 370 | $this->click("//a[@id='crm-contact-actions-link']/span/div"); |
| 371 | |
| 372 | // wait for add plegde link |
| 373 | $this->waitForElementPresent('link=Add Pledge'); |
| 374 | |
| 375 | $this->click('link=Add Pledge'); |
| 376 | |
| 377 | // wait for pledge form to load completely |
| 378 | $this->waitForElementPresent('_qf_Pledge_upload-bottom'); |
| 379 | |
| 380 | // check contact name on pledge form |
| 381 | $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName"); |
| 382 | |
| 383 | $this->type("amount", "30"); |
| 384 | $this->type("installments", "3"); |
| 385 | $this->select("frequency_unit", "value=week"); |
| 386 | $this->type("frequency_day", "2"); |
| 387 | |
| 388 | $this->webtestFillDate('acknowledge_date', 'now'); |
| 389 | |
| 390 | $this->select("contribution_page_id", "value=3"); |
| 391 | |
| 392 | //PaymentReminders |
| 393 | $this->click("PaymentReminders"); |
| 394 | $this->waitForElementPresent("additional_reminder_day"); |
| 395 | $this->type("initial_reminder_day", "4"); |
| 396 | $this->type("max_reminders", "2"); |
| 397 | $this->type("additional_reminder_day", "4"); |
| 398 | |
| 399 | $this->click("_qf_Pledge_upload-bottom"); |
| 400 | |
| 401 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
| 402 | |
| 403 | //Add payments |
| 404 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 405 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
| 406 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
| 407 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
| 408 | $this->waitForElementPresent("_qf_Contribution_upload"); |
| 409 | $this->click("_qf_Contribution_upload"); |
| 410 | |
| 411 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 412 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
| 413 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
| 414 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
| 415 | $this->waitForElementPresent("_qf_Contribution_upload"); |
| 416 | $this->click("_qf_Contribution_upload"); |
| 417 | |
| 418 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 419 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
| 420 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
| 421 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
| 422 | $this->waitForElementPresent("_qf_Contribution_upload"); |
| 423 | $this->click("_qf_Contribution_upload"); |
| 424 | |
| 425 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 426 | //click through to the Pledge view screen |
| 427 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
| 428 | $this->waitForElementPresent("_qf_PledgeView_next-bottom"); |
| 429 | $pledgeDate = date('F jS, Y', strtotime('now')); |
| 430 | |
| 431 | $this->webtestVerifyTabularData(array( |
| 432 | 'Pledge By' => $firstName . ' ' . $lastName, |
| 433 | 'Total Pledge Amount' => '$ 30.00', |
| 434 | 'To be paid in' => '3 installments of $ 10.00 every 1 week(s)', |
| 435 | 'Payments are due on the' => '2 day of the period', |
| 436 | 'Pledge Made' => $pledgeDate, |
| 437 | 'Financial Type' => 'Donation', |
| 438 | 'Pledge Status' => 'Completed', |
| 439 | 'Initial Reminder Day' => '4 days prior to schedule date', |
| 440 | 'Maximum Reminders Send' => 2, |
| 441 | 'Send additional reminders' => '4 days after the last one sent', |
| 442 | ) |
| 443 | ); |
| 444 | // Re-enable pop-ups to leave things in the same state |
| 445 | $this->enableDisablePopups(TRUE); |
| 446 | } |
| 447 | |
| 448 | } |