Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
232624b1 | 4 | | CiviCRM version 4.4 | |
6a488035 TO |
5 | +--------------------------------------------------------------------+ |
6 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 TO |
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
28 | class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected function setUp() { | |
31 | parent::setUp(); | |
32 | } | |
33 | ||
34 | function testStandalonePledgeAdd() { | |
6a488035 TO |
35 | $this->webtestLogin(); |
36 | ||
d2771e94 | 37 | $this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload'); |
6a488035 TO |
38 | |
39 | // create new contact using dialog | |
40 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
41 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
42 | $this->webtestNewDialogContact($firstName, $lastName, $firstName . '@example.com'); | |
43 | ||
44 | $this->type('amount', '100'); | |
45 | $this->type('installments', '10'); | |
46 | $this->select('frequency_unit', 'value=week'); | |
47 | $this->type('frequency_day', '2'); | |
48 | ||
49 | $this->webtestFillDate('acknowledge_date', 'now'); | |
50 | ||
51 | $this->select('contribution_page_id', 'value=3'); | |
52 | ||
53 | //Honoree section | |
54 | $this->click('Honoree'); | |
55 | $this->waitForElementPresent('honor_email'); | |
56 | ||
57 | $this->click('CIVICRM_QFID_1_2'); | |
58 | $this->select('honor_prefix_id', 'value=3'); | |
59 | ||
60 | $honorFirstName = 'Fo' . substr(sha1(rand()), 0, 4); | |
61 | $honorLastName = 'Ba' . substr(sha1(rand()), 0, 7); | |
62 | $this->type('honor_first_name', $honorFirstName); | |
63 | $this->type('honor_last_name', $honorLastName); | |
64 | $this->type('honor_email', $honorFirstName . '@example.com'); | |
65 | ||
66 | //PaymentReminders | |
67 | $this->click('PaymentReminders'); | |
68 | $this->waitForElementPresent('additional_reminder_day'); | |
69 | $this->type('initial_reminder_day', '4'); | |
70 | $this->type('max_reminders', '2'); | |
71 | $this->type('additional_reminder_day', '4'); | |
72 | ||
73 | $this->click('_qf_Pledge_upload-bottom'); | |
74 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
75 | ||
6c5f7368 | 76 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 TO |
77 | |
78 | // verify if Pledge is created | |
79 | $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); | |
80 | ||
81 | //click through to the Pledge view screen | |
82 | $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); | |
83 | $this->waitForElementPresent('_qf_PledgeView_next-bottom'); | |
84 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
85 | ||
86 | $this->webtestVerifyTabularData(array( | |
87 | 'Pledge By' => $firstName . ' ' . $lastName, | |
88 | 'Total Pledge Amount' => '$ 100.00', | |
89 | 'To be paid in' => '10 installments of $ 10.00 every 1 week(s)', | |
90 | 'Payments are due on the' => '2 day of the period', | |
91 | 'Pledge Made' => $pledgeDate, | |
92 | 'Financial Type' => 'Donation', | |
93 | 'Pledge Status' => 'Pending', | |
94 | 'In Honor of' => 'Mr. ' . $honorFirstName . ' ' . $honorLastName, | |
95 | 'Initial Reminder Day' => '4 days prior to schedule date', | |
96 | 'Maximum Reminders Send' => 2, | |
97 | 'Send additional reminders' => '4 days after the last one sent', | |
98 | ) | |
99 | ); | |
225a8648 | 100 | $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
101 | $this->click("xpath=//div[@id='Pledges']//table//tbody/tr[1]/td[1]/span/a"); |
102 | $this->waitForElementPresent("xpath=//div[@id='Pledges']//table//tbody//tr//td/table/tbody/tr[2]/td[8]/a[text()='Record Payment (Check, Cash, EFT ...)']"); | |
103 | } | |
104 | } | |
105 |