3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Pledge_ContactContextAddTest
32 class WebTest_Pledge_ContactContextAddTest
extends CiviSeleniumTestCase
{
34 protected function setUp() {
38 function testContactContextAddTest() {
39 $this->webtestLogin();
42 $name = substr(sha1(rand()), 0, 7);
43 $firstName = 'Adam' . $name;
44 $lastName = 'Jones' . $name;
47 $this->webtestAddContact($firstName, $lastName, $firstName . "@example.com");
49 // wait for action element
50 $this->waitForElementPresent('crm-contact-actions-link');
52 // now add pledge from contact summary
53 $this->click("//a[@id='crm-contact-actions-link']/span/div");
55 // wait for add plegde link
56 $this->waitForElementPresent('link=Add Pledge');
58 $this->click('link=Add Pledge');
60 // wait for pledge form to load completely
61 $this->waitForElementPresent('_qf_Pledge_upload-bottom');
63 // check contact name on pledge form
64 $this->assertElementContainsText('css=tr.crm-pledge-form-block-displayName', "$firstName $lastName");
66 $this->type("amount", "100");
67 $this->type("installments", "10");
68 $this->select("frequency_unit", "value=week");
69 $this->type("frequency_day", "2");
71 $this->webtestFillDate('acknowledge_date', 'now');
73 $this->select("contribution_page_id", "value=3");
77 $this->click("PaymentReminders");
78 $this->waitForElementPresent("additional_reminder_day");
79 $this->type("initial_reminder_day", "4");
80 $this->type("max_reminders", "2");
81 $this->type("additional_reminder_day", "4");
83 $this->click("_qf_Pledge_upload-bottom");
85 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
87 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']");
88 //click through to the Pledge view screen
89 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']");
90 $this->waitForElementPresent("_qf_PledgeView_next-bottom");
91 $pledgeDate = date('F jS, Y', strtotime('now'));
94 'Pledge By' => $firstName . ' ' . $lastName,
95 'Total Pledge Amount' => '$ 100.00',
96 'To be paid in' => '10 installments of $ 10.00 every 1 week(s)',
97 'Payments are due on the' => '2 day of the period',
98 'Pledge Made' => $pledgeDate,
99 'Financial Type' => 'Donation',
100 'Pledge Status' => 'Pending',
101 'Initial Reminder Day' => '4 days prior to schedule date',
102 'Maximum Reminders Send' => 2,
103 'Send additional reminders' => '4 days after the last one sent',
106 foreach ($verifyData as $label => $value) {
107 $this->verifyText("xpath=//form[@id='PledgeView']//table/tbody/tr/td[text()='{$label}']/following-sibling::td", preg_quote($value));
110 $this->clickLink("_qf_PledgeView_next-bottom", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span[1]/a[text()='View']", FALSE);
111 $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
112 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody//tr//td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']");