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_StandaloneAddDeleteTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Pledge_StandaloneAddDeleteTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testStandalonePledgeAddDelete() { |
6a488035 TO |
39 | $this->webtestLogin(); |
40 | ||
d2771e94 | 41 | $this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload'); |
6a488035 TO |
42 | |
43 | // create new contact using dialog | |
80f3b91d | 44 | $contact = $this->createDialogContact(); |
6a488035 TO |
45 | |
46 | $this->type('amount', '2400'); | |
47 | $this->type('installments', '10'); | |
48 | $this->select('frequency_unit', 'value=month'); | |
49 | $this->type('frequency_day', '2'); | |
50 | $this->webtestFillDate('acknowledge_date', 'now'); | |
51 | $this->select('contribution_page_id', 'value=3'); | |
52 | $this->click('_qf_Pledge_upload-bottom'); | |
53 | $this->waitForPageToLoad("30000"); | |
54 | ||
6c5f7368 | 55 | $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created."); |
6a488035 TO |
56 | |
57 | // verify if Pledge is created | |
45fabf8e | 58 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
59 | |
60 | //click through to the Pledge view screen | |
45fabf8e | 61 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
6a488035 TO |
62 | $this->waitForElementPresent('_qf_PledgeView_next-bottom'); |
63 | $pledgeDate = date('F jS, Y', strtotime('now')); | |
64 | ||
65 | $this->webtestVerifyTabularData(array( | |
80f3b91d | 66 | 'Pledge By' => $contact['display_name'], |
6a488035 TO |
67 | 'Total Pledge Amount' => '$ 2,400.00', |
68 | 'To be paid in' => '10 installments of $ 240.00 every 1 month(s)', | |
69 | 'Payments are due on the' => '2 day of the period', | |
70 | 'Pledge Made' => $pledgeDate, | |
71 | 'Financial Type' => 'Donation', | |
72 | 'Pledge Status' => 'Pending', | |
73 | ) | |
74 | ); | |
e6c6db94 | 75 | $this->click('_qf_PledgeView_next-bottom'); |
76 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); | |
08f17a9f | 77 | $this->waitForAjaxContent(); |
45fabf8e | 78 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
08f17a9f | 79 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']"); |
45fabf8e | 80 | $this->click("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a"); |
6a488035 TO |
81 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); |
82 | $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); | |
83 | $this->type('total_amount', '300.00'); | |
76e86fd8 CW |
84 | $this->click('_qf_Contribution_upload-bottom'); |
85 | ||
6c5f7368 | 86 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
76e86fd8 | 87 | |
45fabf8e | 88 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
08f17a9f | 89 | $this->waitForAjaxContent(); |
45fabf8e | 90 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
08f17a9f | 91 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a[text()='Record Payment']"); |
45fabf8e | 92 | $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[8]/a"); |
6a488035 TO |
93 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); |
94 | $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); | |
95 | $this->type('total_amount', '250.00'); | |
96 | $this->click('_qf_Contribution_upload-bottom'); | |
6c5f7368 | 97 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
76e86fd8 | 98 | |
45fabf8e | 99 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']"); |
08f17a9f | 100 | $this->waitForAjaxContent(); |
45fabf8e | 101 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
08f17a9f | 102 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a[text()='Record Payment']"); |
45fabf8e | 103 | $this->click("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[4]/td[8]/a"); |
6a488035 | 104 | $this->waitForElementPresent("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); |
76e86fd8 CW |
105 | $this->click("xpath=//form[@id='Contribution']//div[2]/table/tbody/tr[3]/td[2]/a"); |
106 | ||
6a488035 TO |
107 | $this->type('total_amount', '170.00'); |
108 | $this->click('_qf_Contribution_upload-bottom'); | |
6c5f7368 | 109 | $this->waitForText('crm-notification-container', "The contribution record has been saved."); |
76e86fd8 | 110 | |
6a488035 | 111 | // delete the contribution associated with the 2nd payment |
e6c6db94 | 112 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); |
08f17a9f | 113 | $this->waitForAjaxContent(); |
45fabf8e | 114 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
e6c6db94 | 115 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[2]/td[2]/table[@class='nestedSelector']/tbody/tr[3]/td[8]/a[text()='View Payment']"); |
116 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[2]/td[2]/table[@class='nestedSelector']/tbody/tr[3]/td[8]/a"); | |
117 | $this->waitForElementPresent("xpath=//form[@id='ContributionView']//div[2]/div/div/a[2]/span[text()='Delete']"); | |
118 | $this->click("xpath=//form[@id='ContributionView']//div[2]/div/div/a[2]/span[text()='Delete']"); | |
119 | $this->waitForElementPresent("xpath=//form[@id='Contribution']/div[2]/div[2]/span/input[@value='Delete']"); | |
120 | $this->click("xpath=//form[@id='Contribution']/div[2]/div[2]/span/input[@value='Delete']"); | |
8cc4f1ab | 121 | $this->waitForElementPresent("xpath=//li[@id='tab_pledge']/a"); |
122 | $this->click("xpath=//li[@id='tab_pledge']/a"); | |
45fabf8e | 123 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[10]/span/a[text()='View']"); |
08f17a9f | 124 | $this->waitForAjaxContent(); |
45fabf8e | 125 | $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a"); |
126 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]"); | |
76e86fd8 | 127 | |
6c6e6187 | 128 | $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td[7]", "Pending"); |
45fabf8e | 129 | $this->waitForElementPresent("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td"); |
76e86fd8 | 130 | |
6a488035 | 131 | // verify that payment owed amount is correct (250.00) |
6c6e6187 | 132 | $this->verifyText("xpath=//div[@class='view-content']//table/tbody/tr[2]/td[2]/table/tbody/tr[3]/td", "250.00"); |
6a488035 | 133 | // verify that Total Paid and Balance sums are correct |
6c6e6187 TO |
134 | $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[3]", "470.00"); |
135 | $this->verifyText("xpath=//div[@class='view-content' and contains(., 'view pledge payments')]/table[@class='selector row-highlight']//tbody/tr[1]/td[4]", "1,930.00"); | |
76e86fd8 | 136 | |
6a488035 | 137 | } |
96025800 | 138 | |
6a488035 | 139 | } |