TYPO3 CMS  TYPO3_8-7
ListUserCest.php
Go to the documentation of this file.
1 <?php
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 
18 
23 {
27  public function _before(BackendTester $I)
28  {
29  $I->useExistingSession('admin');
30 
31  $I->see('Backend users');
32  $I->click('Backend users');
33 
34  $I->switchToContentFrame();
35  }
36 
41  {
42  $I->see('Backend User Listing');
43 
44  $I->wantTo('See the table of users');
45  $I->waitForElementVisible('#typo3-backend-user-list');
46 
47  // We expect exact four Backend Users created from the Fixtures
48  $this->checkCountOfUsers($I, 4);
49  }
50 
55  {
56  $I->wantTo('See the table of users');
57  $I->waitForElementVisible('#typo3-backend-user-list');
58  // We expect exact four Backend Users created from the Fixtures
59  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
60 
61  $I->wantTo('Filter the list of user by valid username admin');
62  $I->fillField('#tx_Beuser_username', 'admin');
63  $I->click('Filter');
64  $I->waitForElementNotVisible('div#nprogess');
65  $I->waitForElementVisible('#typo3-backend-user-list');
66 
67  // We expect exact one fitting Backend User created from the Fixtures
68  $this->checkCountOfUsers($I, 1);
69 
70  $I->wantTo('Filter the list of user by valid username administrator');
71  $I->fillField('#tx_Beuser_username', 'administrator');
72  $I->click('Filter');
73  $I->waitForElementNotVisible('div#nprogess');
74  $I->waitForElementVisible('#typo3-backend-user-list');
75 
76  // We expect exact no fitting Backend User created from the Fixtures
77  $this->checkCountOfUsers($I, 0);
78  }
79 
83  public function filterUsersByAdmin(BackendTester $I)
84  {
85  $I->wantTo('See the table of users');
86  $I->waitForElementVisible('#typo3-backend-user-list');
87  // We expect exact four Backend Users created from the Fixtures
88  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
89 
90  $I->wantToTest('Filter BackendUser and see only admins');
91  $I->selectOption('#tx_Beuser_usertype', 'Admin only');
92  $I->click('Filter');
93  $I->waitForElementNotVisible('div#nprogess');
94  $I->waitForElementVisible('#typo3-backend-user-list');
95 
96  // We expect exact two fitting Backend Users created from the Fixtures
97  $this->checkCountOfUsers($I, 2);
98 
99  $I->wantToTest('Filter BackendUser and see normal users');
100  $I->selectOption('#tx_Beuser_usertype', 'Normal users only');
101  $I->click('Filter');
102  $I->waitForElementNotVisible('div#nprogess');
103  $I->waitForElementVisible('#typo3-backend-user-list');
104 
105  // We expect exact two fitting Backend Users created from the Fixtures
106  $this->checkCountOfUsers($I, 2);
107  }
108 
112  public function filterUsersByStatus(BackendTester $I)
113  {
114  $I->wantTo('See the table of users');
115  $I->waitForElementVisible('#typo3-backend-user-list');
116  // We expect exact four Backend Users created from the Fixtures
117  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
118 
119  $I->wantToTest('Filter BackendUser and see only active users');
120  $I->selectOption('#tx_Beuser_status', 'Active only');
121  $I->click('Filter');
122  $I->waitForElementNotVisible('div#nprogess');
123  $I->waitForElementVisible('#typo3-backend-user-list');
124 
125  // We expect exact two fitting Backend Users created from the Fixtures
126  $this->checkCountOfUsers($I, 2);
127 
128  $I->wantToTest('Filter BackendUser and see only inactive users');
129  $I->selectOption('#tx_Beuser_status', 'Inactive only');
130  $I->click('Filter');
131  $I->waitForElementNotVisible('div#nprogess');
132  $I->waitForElementVisible('#typo3-backend-user-list');
133 
134  // We expect exact two fitting Backend Users created from the Fixtures
135  $this->checkCountOfUsers($I, 2);
136  }
137 
141  public function filterUsersByLogin(BackendTester $I)
142  {
143  $I->wantTo('See the table of users');
144  $I->waitForElementVisible('#typo3-backend-user-list');
145  // We expect exact four Backend Users created from the Fixtures
146  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
147 
148  $I->wantToTest('Filter BackendUser and see only users logged in before');
149  $I->selectOption('#tx_Beuser_logins', 'Logged in before');
150  $I->click('Filter');
151  $I->waitForElementNotVisible('div#nprogess');
152  $I->waitForElementVisible('#typo3-backend-user-list');
153 
154  // We expect exact two fitting Backend Users created from the Fixtures
155  $this->checkCountOfUsers($I, 2);
156 
157  $I->wantToTest('Filter BackendUser and see only users never logged in before');
158  $I->selectOption('#tx_Beuser_logins', 'Never logged in');
159  $I->click('Filter');
160  $I->waitForElementNotVisible('div#nprogess');
161  $I->waitForElementVisible('#typo3-backend-user-list');
162 
163  // We expect exact two fitting Backend Users created from the Fixtures
164  $this->checkCountOfUsers($I, 2);
165  }
166 
171  {
172  $I->wantTo('See the table of users');
173  $I->waitForElementVisible('#typo3-backend-user-list');
174  // We expect exact four Backend Users created from the Fixtures
175  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
176 
177  // We expect exact one Backend Users created from the Fixtures has the usergroup named 'editor-group'
178  $I->wantToTest('Filter BackendUser and see only users with given usergroup');
179  $I->selectOption('#tx_beuser_backendUserGroup', 'editor-group');
180  $I->click('Filter');
181  $I->waitForElementNotVisible('div#nprogess');
182  $I->waitForElementVisible('#typo3-backend-user-list');
183 
184  // We expect exact one fitting Backend User created from the Fixtures
185  $this->checkCountOfUsers($I, 1);
186  }
187 
192  protected function checkCountOfUsers(BackendTester $I, $countOfUsers)
193  {
194  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', $countOfUsers);
195  $I->wantToTest('If a number of users is shown in the footer row');
196  $I->canSeeNumberOfElements('#typo3-backend-user-list tfoot tr', 1);
197  $I->see($countOfUsers . ' Users', '#typo3-backend-user-list tfoot tr');
198  }
199 }