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