Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
232624b1 | 4 | | CiviCRM version 4.4 | |
6a488035 TO |
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 | ||
6a488035 TO |
27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
28 | class WebTest_Case_CaseDashboardTest extends CiviSeleniumTestCase { | |
29 | ||
30 | protected function setUp() { | |
31 | parent::setUp(); | |
32 | } | |
33 | ||
34 | function testAllOrMyCases() { | |
6a488035 | 35 | // Log in as admin first to verify permissions for CiviCase |
42daf119 | 36 | $this->webtestLogin('true'); |
6a488035 TO |
37 | |
38 | // Enable CiviCase module if necessary | |
b9715b8a | 39 | $this->enableComponents("CiviCase"); |
6a488035 TO |
40 | |
41 | // let's give full CiviCase permissions to demo user (registered user). | |
42 | $permission = array('edit-2-access-all-cases-and-activities', 'edit-2-access-my-cases-and-activities', 'edit-2-administer-civicase', 'edit-2-delete-in-civicase'); | |
43 | $this->changePermissions($permission); | |
44 | ||
42daf119 CW |
45 | // Log in as normal user |
46 | $this->webtestLogin(); | |
47 | ||
48 | $this->openCiviPage('case', 'reset=1'); | |
6a488035 TO |
49 | |
50 | // Should default to My Cases | |
51 | $this->assertTrue($this->isChecked("name=allupcoming value=0"), 'Case dashboard should default to My Cases.'); | |
52 | // The header text of the table changes too | |
1712131c | 53 | $this->assertElementContainsText('crm-container', "Summary of Involvement"); |
6a488035 | 54 | |
225a8648 | 55 | $this->clickLink("name=allupcoming value=1", "css=a.button"); |
6a488035 TO |
56 | |
57 | $this->assertTrue($this->isChecked("name=allupcoming value=1"), 'Selection of All Cases failed.'); | |
d2771e94 | 58 | $this->assertElementContainsText('crm-container', "Summary of All Cases"); |
6a488035 TO |
59 | |
60 | // Go back to dashboard | |
d2771e94 | 61 | $this->openCiviPage('case', 'reset=1', 'css=a.button'); |
6a488035 TO |
62 | |
63 | // Click on find my cases and check if right radio is checked | |
225a8648 | 64 | $this->clickLink("name=find_my_cases", "css=input.form-submit"); |
6a488035 TO |
65 | $this->assertTrue($this->isChecked("name=case_owner value=2"), 'Find my cases button not properly setting search form value to my cases.'); |
66 | ||
67 | // Go back to dashboard | |
d2771e94 | 68 | $this->openCivipage('case', 'reset=1', 'css=a.button'); |
6a488035 TO |
69 | |
70 | // Click on a drilldown cell and check if right radio is checked | |
225a8648 | 71 | $this->clickLink("css=a.crm-case-summary-drilldown", "css=input.form-submit"); |
6a488035 TO |
72 | $this->assertTrue($this->isChecked("name=case_owner value=1"), 'Drilldown on dashboard summary cells not properly setting search form value to all cases.'); |
73 | ||
74 | // Go back to dashboard and reset to my cases | |
d2771e94 | 75 | $this->openCiviPage('case', 'reset=1', 'css=a.button'); |
225a8648 | 76 | $this->clickLink("name=allupcoming value=0", "css=a.button"); |
6a488035 TO |
77 | |
78 | // Click on a drilldown cell and check if right radio is checked | |
225a8648 | 79 | $this->clickLink("css=a.crm-case-summary-drilldown", "css=input.form-submit"); |
6a488035 TO |
80 | $this->assertTrue($this->isChecked("name=case_owner value=2"), 'Drilldown on dashboard summary cells not properly setting search form value to my cases.'); |
81 | } | |
82 | } | |
83 |