[BUGFIX] Acceptance tests fails due to viewport changes
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / BackendUser / ListUserCest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Admin;
18
19 /**
20 * List User tests
21 */
22 class ListUserCest
23 {
24 /**
25 * @param Admin $I
26 * @return void
27 */
28 public function _before(Admin $I)
29 {
30 $I->useExistingSession();
31 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
32 $I->switchToIFrame('contentIframe');
33 $I->waitForText('Web Content Management System');
34 $I->switchToIFrame();
35
36 $I->see('Backend users');
37 $I->click('Backend users');
38
39 // switch to content iframe
40 $I->switchToIFrame('contentIframe');
41 }
42
43 /**
44 * @param Admin $I
45 * @return void
46 */
47 public function showsHeadingAndListsBackendUsers(Admin $I)
48 {
49 $I->see('Backend User Listing');
50
51 $I->wantTo('See the table of users');
52 $I->waitForElementVisible('#typo3-backend-user-list');
53
54 // We expect exact four Backend Users created from the Fixtures
55 $this->checkCountOfUsers($I, 4);
56 }
57
58 /**
59 * @param Admin $I
60 * @return void
61 */
62 public function filterUsersByUsername(Admin $I)
63 {
64 $I->wantTo('See the table of users');
65 $I->waitForElementVisible('#typo3-backend-user-list');
66 // We expect exact four Backend Users created from the Fixtures
67 $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
68
69 $I->wantTo('Filter the list of user by valid username admin');
70 $I->fillField('#tx_Beuser_username', 'admin');
71 $I->click('Filter');
72 $I->waitForElementVisible('#typo3-backend-user-list');
73
74 // We expect exact one fitting Backend User created from the Fixtures
75 $this->checkCountOfUsers($I, 1);
76
77 $I->wantTo('Filter the list of user by valid username administrator');
78 $I->fillField('#tx_Beuser_username', 'administrator');
79 $I->click('Filter');
80 $I->waitForElementVisible('#typo3-backend-user-list');
81
82 // We expect exact no fitting Backend User created from the Fixtures
83 $this->checkCountOfUsers($I, 0);
84 }
85
86 /**
87 * @param Admin $I
88 * @return void
89 */
90 public function filterUsersByAdmin(Admin $I)
91 {
92 $I->wantTo('See the table of users');
93 $I->waitForElementVisible('#typo3-backend-user-list');
94 // We expect exact four Backend Users created from the Fixtures
95 $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
96
97 $I->wantToTest('Filter BackendUser and see only admins');
98 $I->selectOption('#tx_Beuser_usertype', 'Admin only');
99 $I->click('Filter');
100 $I->waitForElementVisible('#typo3-backend-user-list');
101
102 // We expect exact two fitting Backend Users created from the Fixtures
103 $this->checkCountOfUsers($I, 2);
104
105 $I->wantToTest('Filter BackendUser and see normal users');
106 $I->selectOption('#tx_Beuser_usertype', 'Normal users only');
107 $I->click('Filter');
108 $I->waitForElementVisible('#typo3-backend-user-list');
109
110 // We expect exact two fitting Backend Users created from the Fixtures
111 $this->checkCountOfUsers($I, 2);
112 }
113
114 /**
115 * @param Admin $I
116 * @return void
117 */
118 public function filterUsersByStatus(Admin $I)
119 {
120 $I->wantTo('See the table of users');
121 $I->waitForElementVisible('#typo3-backend-user-list');
122 // We expect exact four Backend Users created from the Fixtures
123 $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
124
125 $I->wantToTest('Filter BackendUser and see only active users');
126 $I->selectOption('#tx_Beuser_status', 'Active only');
127 $I->click('Filter');
128 $I->waitForElementVisible('#typo3-backend-user-list');
129
130 // We expect exact two fitting Backend Users created from the Fixtures
131 $this->checkCountOfUsers($I, 2);
132
133 $I->wantToTest('Filter BackendUser and see only inactive users');
134 $I->selectOption('#tx_Beuser_status', 'Inactive only');
135 $I->click('Filter');
136 $I->waitForElementVisible('#typo3-backend-user-list');
137
138 // We expect exact two fitting Backend Users created from the Fixtures
139 $this->checkCountOfUsers($I, 2);
140 }
141
142 /**
143 * @param Admin $I
144 * @return void
145 */
146 public function filterUsersByLogin(Admin $I)
147 {
148 $I->wantTo('See the table of users');
149 $I->waitForElementVisible('#typo3-backend-user-list');
150 // We expect exact four Backend Users created from the Fixtures
151 $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
152
153 $I->wantToTest('Filter BackendUser and see only users logged in before');
154 $I->selectOption('#tx_Beuser_logins', 'Logged in before');
155 $I->click('Filter');
156 $I->waitForElementVisible('#typo3-backend-user-list');
157
158 // We expect exact two fitting Backend Users created from the Fixtures
159 $this->checkCountOfUsers($I, 2);
160
161 $I->wantToTest('Filter BackendUser and see only users never logged in before');
162 $I->selectOption('#tx_Beuser_logins', 'Never logged in');
163 $I->click('Filter');
164 $I->waitForElementVisible('#typo3-backend-user-list');
165
166 // We expect exact two fitting Backend Users created from the Fixtures
167 $this->checkCountOfUsers($I, 2);
168 }
169
170 /**
171 * @param Admin $I
172 * @return void
173 */
174 public function filterUsersByUserGroup(Admin $I)
175 {
176 $I->wantTo('See the table of users');
177 $I->waitForElementVisible('#typo3-backend-user-list');
178 // We expect exact four Backend Users created from the Fixtures
179 $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
180
181 // We expect exact one Backend Users created from the Fixtures has the usergroup named 'editor-group'
182 $I->wantToTest('Filter BackendUser and see only users with given usergroup');
183 $I->selectOption('#tx_beuser_backendUserGroup', 'editor-group');
184 $I->click('Filter');
185 $I->waitForElementVisible('#typo3-backend-user-list');
186
187 // We expect exact one fitting Backend User created from the Fixtures
188 $this->checkCountOfUsers($I, 1);
189 }
190
191 /**
192 * @param Admin $I
193 * @param int $countOfUsers
194 * @return void
195 */
196 protected function checkCountOfUsers(Admin $I, $countOfUsers)
197 {
198 $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', $countOfUsers);
199 $I->wantToTest('If a number of users is shown in the footer row');
200 $I->canSeeNumberOfElements('#typo3-backend-user-list tfoot tr', 1);
201 $I->see($countOfUsers . ' Users', '#typo3-backend-user-list tfoot tr');
202 }
203 }