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