Merge pull request #233 from mlutfy/minifixes
[civicrm-core.git] / tests / phpunit / WebTest / Report / DonarReportTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
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
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
28 class WebTest_Report_DonarReportTest extends CiviSeleniumTestCase {
29
30 protected function setUp() {
31 parent::setUp();
32 }
33
34 function testDonarReportPager() {
35 $this->webtestLogin();
36
37 // now create new donar detail report instance
38 $this->openCiviPage('report/contribute/detail', 'reset=1', '_qf_Detail_submit');
39
40 // preview result
41 $this->click("_qf_Detail_submit");
42 $this->waitForPageToLoad($this->getTimeoutMsec());
43
44 // Create report
45 $this->click("css=div.crm-report_setting-accordion div.crm-accordion-header");
46 $this->waitForElementPresent("title");
47
48 $reportName = 'ContributeDetail_' . substr(sha1(rand()), 0, 7);
49 $reportDescription = "New Contribute Detail Report";
50
51 // Fill Report Title
52 $this->type("title", $reportName);
53
54 // Fill Report Description
55 $this->type("description", $reportDescription);
56
57 // We want navigation menu
58 $this->click("is_navigation");
59 $this->waitForElementPresent("parent_id");
60
61 // Navigation menu under Reports section
62 $this->select("parent_id", "label=Reports");
63
64 // Set permission as access CiviCRM
65 $this->select("permission", "value=access CiviCRM");
66
67 // click to create report
68 $this->click("_qf_Detail_submit_save");
69 $this->waitForPageToLoad($this->getTimeoutMsec());
70
71 // Open report list
72 $this->openCiviPage('report/list', 'reset=1');
73
74 // Is report is resent in list?
75 $this->assertElementContainsText('css=div#Contribute > table.report-layout', $reportName);
76
77 // Visit report
78 $this->click("link=$reportName");
79 $this->waitForPageToLoad($this->getTimeoutMsec());
80
81 //now select the criteria
82 //click report criteria accordian
83 $this->click("css=div.crm-report_criteria-accordion div.crm-accordion-header");
84
85 //enter contribution amount
86 $this->select('total_amount_op', "value=gte");
87 $this->type('total_amount_value', "10");
88
89 // click preview
90 $this->click("_qf_Detail_submit");
91 $this->waitForPageToLoad($this->getTimeoutMsec());
92
93 //Is greater than or equal to 100
94 //check for criteria
95 $this->assertElementContainsText('css=table.statistics-table', "Is greater than or equal to 10", "Criteria is not selected");
96
97 //click on next link
98 $this->click("_qf_Detail_submit_save");
99 $this->waitForPageToLoad($this->getTimeoutMsec());
100
101 // check if criteria still exits
102 $this->assertElementContainsText('css=table.statistics-table', "Is greater than or equal to 10", "Criteria is not selected");
103 }
104 }