add autogenerated comment blocks to tests dir
[civicrm-core.git] / tests / phpunit / WebTest / Report / DonarReportTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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 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 $this->click("css=div.crm-report_setting-accordion div.crm-accordion-header");
50 $this->waitForElementPresent("title");
51
52 $reportName = 'ContributeDetail_' . substr(sha1(rand()), 0, 7);
53 $reportDescription = "New Contribute Detail Report";
54
55 // Fill Report Title
56 $this->type("title", $reportName);
57
58 // Fill Report Description
59 $this->type("description", $reportDescription);
60
61 // We want navigation menu
62 $this->click("is_navigation");
63 $this->waitForElementPresent("parent_id");
64
65 // Navigation menu under Reports section
66 $this->select("parent_id", "label=Reports");
67
68 // Set permission as access CiviCRM
69 $this->select("permission", "value=access CiviCRM");
70
71 // click to create report
72 $this->click("_qf_Detail_submit_save");
73 $this->waitForPageToLoad($this->getTimeoutMsec());
74
75 // Open report list
76 $this->openCiviPage('report/list', 'reset=1');
77
78 // Is report is resent in list?
79 $this->assertElementContainsText('css=div#Contribute > table.report-layout', $reportName);
80
81 // Visit report
82 $this->click("xpath=//div[@id='Contribute']//table/tbody//tr/td/a/strong[text() = '$reportName']");
83 $this->waitForPageToLoad($this->getTimeoutMsec());
84
85 //now select the criteria
86 //click report criteria accordian
87 $this->click("css=div.crm-report_criteria-accordion div.crm-accordion-header");
88
89 //enter contribution amount
90 $this->select('total_amount_op', "value=gte");
91 $this->type('total_amount_value', "10");
92
93 // click preview
94 $this->click("_qf_Detail_submit");
95 $this->waitForPageToLoad($this->getTimeoutMsec());
96
97 //Is greater than or equal to 100
98 //check for criteria
99 $this->assertElementContainsText('css=table.statistics-table', "Is greater than or equal to 10", "Criteria is not selected");
100
101 //click on next link
102 $this->click("_qf_Detail_submit_save");
103 $this->waitForPageToLoad($this->getTimeoutMsec());
104
105 // check if criteria still exits
106 $this->assertElementContainsText('css=table.statistics-table', "Is greater than or equal to 10", "Criteria is not selected");
107 }
108 }