Merge pull request #8012 from agh1/multi-paypal-ipn-47
[civicrm-core.git] / tests / phpunit / WebTest / Report / DonarReportTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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_Report_DonarReportTest
31 */
32 class WebTest_Report_DonarReportTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
38 public function testDonarReportPager() {
39 $this->webtestLogin();
40
41 // now create new donar detail report instance
42 $this->openCiviPage('report/contribute/detail', 'reset=1', '_qf_Detail_submit');
43
44 // preview result
45 $this->click("_qf_Detail_submit");
46 $this->waitForPageToLoad($this->getTimeoutMsec());
47
48 // Create report
49
50 $reportName = 'ContributeDetail_' . substr(sha1(rand()), 0, 7);
51 $reportDescription = "New Contribute Detail Report";
52
53 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[4]/a");
54 $this->waitForElementPresent("xpath=//div[@class='crm-submit-buttons']");
55 $this->click("xpath=//div[@class='crm-submit-buttons']/input[@name='_qf_Detail_submit_save']");
56
57 // Fill Report Title
58 $this->waitForElementPresent("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog']/table/tbody/tr[1]/td[2]/input[@type='text']");
59 $this->type("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog']/table/tbody/tr[1]/td[2]/input[@type='text']", $reportName);
60
61 // Fill Report Description
62 $this->waitForElementPresent("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog']/table/tbody/tr[2]/td[2]/input[@type='text']");
63 $this->type("xpath=//div[@class='crm-confirm-dialog ui-dialog-content ui-widget-content modal-dialog']/table/tbody/tr[2]/td[2]/input[@type='text']", $reportDescription);
64 $this->click("xpath=//div[@class='ui-dialog-buttonset']/button[1]/span[2]");
65
66 // We want navigation menu
67 $this->waitForElementPresent('_qf_Detail_submit_next');
68 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[6]/a");
69 $this->click("is_navigation");
70 $this->waitForElementPresent("parent_id");
71
72 // Navigation menu under Reports section
73 $this->select("parent_id", "label=Reports");
74
75 // Set permission as access CiviCRM
76 $this->select("permission", "value=access CiviCRM");
77
78 // click to create report
79 $this->click("_qf_Detail_submit_save");
80 $this->waitForPageToLoad($this->getTimeoutMsec());
81
82 // Open report list
83 $this->openCiviPage('report/list', 'reset=1');
84
85 // Is report is resent in list?
86 $this->assertElementContainsText('css=div#Contribute > table.report-layout', $reportName);
87
88 // Visit report
89 $this->click("xpath=//div[@id='Contribute']//table/tbody//tr/td/a/strong[text() = '$reportName']");
90 $this->waitForPageToLoad($this->getTimeoutMsec());
91
92 //now select the criteria
93 //click report criteria accordion
94 $this->click("xpath=//div[@id='mainTabContainer']/ul/li[3]/a");
95 $this->waitForElementPresent('_qf_Detail_submit_next');
96
97 //enter contribution amount
98 $this->waitForAjaxContent();
99 $this->select('total_amount_op', "value=gte");
100 $this->type('total_amount_value', "10");
101
102 // click preview
103 $this->click("_qf_Detail_submit");
104 $this->waitForPageToLoad($this->getTimeoutMsec());
105
106 //Is greater than or equal to 100
107 //check for criteria
108 $this->verifyText("xpath=//table[@class='report-layout statistics-table']/tbody/tr[3]/td", "Is greater than or equal to 10");
109
110 //click on next link
111 $this->click("_qf_Detail_submit");
112 $this->waitForPageToLoad($this->getTimeoutMsec());
113
114 // check if criteria still exits
115 $this->verifyText("xpath=//table[@class='report-layout statistics-table']/tbody/tr[3]/td", "Is greater than or equal to 10");
116 }
117
118 }