‪TYPO3CMS  10.4
ListUserCest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
26 {
30  public function ‪_before(‪BackendTester $I)
31  {
32  $I->useExistingSession('admin');
33 
34  $I->see('Backend Users');
35  $I->click('Backend Users');
36 
37  $I->switchToContentFrame();
38  }
39 
44  {
45  $I->see('Backend User Listing');
46 
47  $I->wantTo('See the table of users');
48  $I->waitForElementVisible('#typo3-backend-user-list');
49 
50  // We expect exact four Backend Users created from the Fixtures
51  $this->‪checkCountOfUsers($I, 4);
52  }
53 
58  {
59  $I->wantTo('See the table of users');
60  $I->waitForElementVisible('#typo3-backend-user-list');
61  // We expect exact four Backend Users created from the Fixtures
62  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
63 
64  $I->wantTo('Filter the list of user by valid username admin');
65  $I->fillField('#tx_Beuser_username', 'admin');
66  $I->click('Filter');
67  $I->waitForElementNotVisible('div#nprogess');
68  $I->waitForElementVisible('#typo3-backend-user-list');
69 
70  // We expect exact one fitting Backend User created from the Fixtures
71  $this->‪checkCountOfUsers($I, 1);
72 
73  $I->wantTo('Filter the list of user by valid username administrator');
74  $I->fillField('#tx_Beuser_username', 'administrator');
75  $I->click('Filter');
76  $I->waitForElementNotVisible('div#nprogess');
77  $I->waitForElementVisible('#typo3-backend-user-list');
78 
79  // We expect exact no fitting Backend User created from the Fixtures
80  $this->‪checkCountOfUsers($I, 0);
81  }
82 
87  {
88  $I->wantTo('See the table of users');
89  $I->waitForElementVisible('#typo3-backend-user-list');
90  // We expect exact four Backend Users created from the Fixtures
91  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
92 
93  $I->wantToTest('Filter BackendUser and see only admins');
94  $I->selectOption('#tx_Beuser_usertype', 'Admin only');
95  $I->click('Filter');
96  $I->waitForElementNotVisible('div#nprogess');
97  $I->waitForElementVisible('#typo3-backend-user-list');
98 
99  // We expect exact two fitting Backend Users created from the Fixtures
100  $this->‪checkCountOfUsers($I, 2);
101 
102  $I->wantToTest('Filter BackendUser and see normal users');
103  $I->selectOption('#tx_Beuser_usertype', 'Normal users only');
104  $I->click('Filter');
105  $I->waitForElementNotVisible('div#nprogess');
106  $I->waitForElementVisible('#typo3-backend-user-list');
107 
108  // We expect exact two fitting Backend Users created from the Fixtures
109  $this->‪checkCountOfUsers($I, 2);
110  }
111 
116  {
117  $I->wantTo('See the table of users');
118  $I->waitForElementVisible('#typo3-backend-user-list');
119  // We expect exact four Backend Users created from the Fixtures
120  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
121 
122  $I->wantToTest('Filter BackendUser and see only active users');
123  $I->selectOption('#tx_Beuser_status', 'Active only');
124  $I->click('Filter');
125  $I->waitForElementNotVisible('div#nprogess');
126  $I->waitForElementVisible('#typo3-backend-user-list');
127 
128  // We expect exact two fitting Backend Users created from the Fixtures
129  $this->‪checkCountOfUsers($I, 2);
130 
131  $I->wantToTest('Filter BackendUser and see only inactive users');
132  $I->selectOption('#tx_Beuser_status', 'Inactive only');
133  $I->click('Filter');
134  $I->waitForElementNotVisible('div#nprogess');
135  $I->waitForElementVisible('#typo3-backend-user-list');
136 
137  // We expect exact two fitting Backend Users created from the Fixtures
138  $this->‪checkCountOfUsers($I, 2);
139  }
140 
145  {
146  $I->wantTo('See the table of users');
147  $I->waitForElementVisible('#typo3-backend-user-list');
148  // We expect exact four Backend Users created from the Fixtures
149  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
150 
151  $I->wantToTest('Filter BackendUser and see only users logged in before');
152  $I->selectOption('#tx_Beuser_logins', 'Logged in before');
153  $I->click('Filter');
154  $I->waitForElementNotVisible('div#nprogess');
155  $I->waitForElementVisible('#typo3-backend-user-list');
156 
157  // We expect exact two fitting Backend Users created from the Fixtures
158  $this->‪checkCountOfUsers($I, 2);
159 
160  $I->wantToTest('Filter BackendUser and see only users never logged in before');
161  $I->selectOption('#tx_Beuser_logins', 'Never logged in');
162  $I->click('Filter');
163  $I->waitForElementNotVisible('div#nprogess');
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 
174  {
175  $I->wantTo('See the table of users');
176  $I->waitForElementVisible('#typo3-backend-user-list');
177  // We expect exact four Backend Users created from the Fixtures
178  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
179 
180  // We expect exact one Backend Users created from the Fixtures has the usergroup named 'editor-group'
181  $I->wantToTest('Filter BackendUser and see only users with given usergroup');
182  $I->selectOption('#tx_beuser_backendUserGroup', 'editor-group');
183  $I->click('Filter');
184  $I->waitForElementNotVisible('div#nprogess');
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 
195  {
196  $I->canSee('Backend User Listing', 'h1');
197  $username = $I->grabTextFrom('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(1) > b');
198 
199  $I->amGoingTo('test the edit button');
200  $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-control > div:nth-child(1) > a');
201  $this->‪openAndCloseTheEditForm($I, $username);
202 
203  $I->amGoingTo('test the edit link on username');
204  $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(1)');
205  $this->‪openAndCloseTheEditForm($I, $username);
206 
207  $I->amGoingTo('test the edit link on real name');
208  $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(4)');
209  $this->‪openAndCloseTheEditForm($I, $username);
210  }
211 
216  private function ‪checkCountOfUsers(‪BackendTester $I, int $countOfUsers)
217  {
218  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', $countOfUsers);
219  $I->wantToTest('If a number of users is shown in the footer row');
220  $I->canSeeNumberOfElements('#typo3-backend-user-list tfoot tr', 1);
221  $I->see($countOfUsers . ' Users', '#typo3-backend-user-list tfoot tr');
222  }
223 
228  private function ‪openAndCloseTheEditForm(‪BackendTester $I, string $username): void
229  {
230  $I->waitForElementNotVisible('#t3js-ui-block');
231  $I->canSee('Edit Backend user "' . $username . '" on root level');
232 
233  $I->click('div.module-docheader .btn.t3js-editform-close');
234  $I->waitForElementVisible('table.table-striped');
235  $I->canSee('Backend User Listing', 'h1');
236  }
237 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\checkCountOfUsers
‪checkCountOfUsers(BackendTester $I, int $countOfUsers)
Definition: ListUserCest.php:216
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\showsHeadingAndListsBackendUsers
‪showsHeadingAndListsBackendUsers(BackendTester $I)
Definition: ListUserCest.php:43
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest
Definition: ListUserCest.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\canEditUsersFromIndexListView
‪canEditUsersFromIndexListView(BackendTester $I)
Definition: ListUserCest.php:194
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByLogin
‪filterUsersByLogin(BackendTester $I)
Definition: ListUserCest.php:144
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByUserGroup
‪filterUsersByUserGroup(BackendTester $I)
Definition: ListUserCest.php:173
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByUsername
‪filterUsersByUsername(BackendTester $I)
Definition: ListUserCest.php:57
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByAdmin
‪filterUsersByAdmin(BackendTester $I)
Definition: ListUserCest.php:86
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\openAndCloseTheEditForm
‪openAndCloseTheEditForm(BackendTester $I, string $username)
Definition: ListUserCest.php:228
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\_before
‪_before(BackendTester $I)
Definition: ListUserCest.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser
Definition: CompareUserCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByStatus
‪filterUsersByStatus(BackendTester $I)
Definition: ListUserCest.php:115