‪TYPO3CMS  9.5
ListUserCest.php
Go to the documentation of this file.
1 <?php
2 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 
24 {
28  public function ‪_before(‪BackendTester $I)
29  {
30  $I->useExistingSession('admin');
31 
32  $I->see('Backend users');
33  $I->click('Backend users');
34 
35  $I->switchToContentFrame();
36  }
37 
42  {
43  $I->see('Backend User Listing');
44 
45  $I->wantTo('See the table of users');
46  $I->waitForElementVisible('#typo3-backend-user-list');
47 
48  // We expect exact four Backend Users created from the Fixtures
49  $this->‪checkCountOfUsers($I, 4);
50  }
51 
56  {
57  $I->wantTo('See the table of users');
58  $I->waitForElementVisible('#typo3-backend-user-list');
59  // We expect exact four Backend Users created from the Fixtures
60  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
61 
62  $I->wantTo('Filter the list of user by valid username admin');
63  $I->fillField('#tx_Beuser_username', 'admin');
64  $I->click('Filter');
65  $I->waitForElementNotVisible('div#nprogess');
66  $I->waitForElementVisible('#typo3-backend-user-list');
67 
68  // We expect exact one fitting Backend User created from the Fixtures
69  $this->‪checkCountOfUsers($I, 1);
70 
71  $I->wantTo('Filter the list of user by valid username administrator');
72  $I->fillField('#tx_Beuser_username', 'administrator');
73  $I->click('Filter');
74  $I->waitForElementNotVisible('div#nprogess');
75  $I->waitForElementVisible('#typo3-backend-user-list');
76 
77  // We expect exact no fitting Backend User created from the Fixtures
78  $this->‪checkCountOfUsers($I, 0);
79  }
80 
85  {
86  $I->wantTo('See the table of users');
87  $I->waitForElementVisible('#typo3-backend-user-list');
88  // We expect exact four Backend Users created from the Fixtures
89  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
90 
91  $I->wantToTest('Filter BackendUser and see only admins');
92  $I->selectOption('#tx_Beuser_usertype', 'Admin only');
93  $I->click('Filter');
94  $I->waitForElementNotVisible('div#nprogess');
95  $I->waitForElementVisible('#typo3-backend-user-list');
96 
97  // We expect exact two fitting Backend Users created from the Fixtures
98  $this->‪checkCountOfUsers($I, 2);
99 
100  $I->wantToTest('Filter BackendUser and see normal users');
101  $I->selectOption('#tx_Beuser_usertype', 'Normal users only');
102  $I->click('Filter');
103  $I->waitForElementNotVisible('div#nprogess');
104  $I->waitForElementVisible('#typo3-backend-user-list');
105 
106  // We expect exact two fitting Backend Users created from the Fixtures
107  $this->‪checkCountOfUsers($I, 2);
108  }
109 
114  {
115  $I->wantTo('See the table of users');
116  $I->waitForElementVisible('#typo3-backend-user-list');
117  // We expect exact four Backend Users created from the Fixtures
118  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
119 
120  $I->wantToTest('Filter BackendUser and see only active users');
121  $I->selectOption('#tx_Beuser_status', 'Active only');
122  $I->click('Filter');
123  $I->waitForElementNotVisible('div#nprogess');
124  $I->waitForElementVisible('#typo3-backend-user-list');
125 
126  // We expect exact two fitting Backend Users created from the Fixtures
127  $this->‪checkCountOfUsers($I, 2);
128 
129  $I->wantToTest('Filter BackendUser and see only inactive users');
130  $I->selectOption('#tx_Beuser_status', 'Inactive only');
131  $I->click('Filter');
132  $I->waitForElementNotVisible('div#nprogess');
133  $I->waitForElementVisible('#typo3-backend-user-list');
134 
135  // We expect exact two fitting Backend Users created from the Fixtures
136  $this->‪checkCountOfUsers($I, 2);
137  }
138 
143  {
144  $I->wantTo('See the table of users');
145  $I->waitForElementVisible('#typo3-backend-user-list');
146  // We expect exact four Backend Users created from the Fixtures
147  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
148 
149  $I->wantToTest('Filter BackendUser and see only users logged in before');
150  $I->selectOption('#tx_Beuser_logins', 'Logged in before');
151  $I->click('Filter');
152  $I->waitForElementNotVisible('div#nprogess');
153  $I->waitForElementVisible('#typo3-backend-user-list');
154 
155  // We expect exact two fitting Backend Users created from the Fixtures
156  $this->‪checkCountOfUsers($I, 2);
157 
158  $I->wantToTest('Filter BackendUser and see only users never logged in before');
159  $I->selectOption('#tx_Beuser_logins', 'Never logged in');
160  $I->click('Filter');
161  $I->waitForElementNotVisible('div#nprogess');
162  $I->waitForElementVisible('#typo3-backend-user-list');
163 
164  // We expect exact two fitting Backend Users created from the Fixtures
165  $this->‪checkCountOfUsers($I, 2);
166  }
167 
172  {
173  $I->wantTo('See the table of users');
174  $I->waitForElementVisible('#typo3-backend-user-list');
175  // We expect exact four Backend Users created from the Fixtures
176  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', 4);
177 
178  // We expect exact one Backend Users created from the Fixtures has the usergroup named 'editor-group'
179  $I->wantToTest('Filter BackendUser and see only users with given usergroup');
180  $I->selectOption('#tx_beuser_backendUserGroup', 'editor-group');
181  $I->click('Filter');
182  $I->waitForElementNotVisible('div#nprogess');
183  $I->waitForElementVisible('#typo3-backend-user-list');
184 
185  // We expect exact one fitting Backend User created from the Fixtures
186  $this->‪checkCountOfUsers($I, 1);
187  }
188 
193  {
194  $I->canSee('Backend User Listing', 'h1');
195  $username = $I->grabTextFrom('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(1) > b');
196 
197  $I->amGoingTo('test the edit button');
198  $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-control > div:nth-child(1) > a');
199  $this->‪openAndCloseTheEditForm($I, $username);
200 
201  $I->amGoingTo('test the edit link on username');
202  $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(1)');
203  $this->‪openAndCloseTheEditForm($I, $username);
204 
205  $I->amGoingTo('test the edit link on real name');
206  $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-title > a:nth-child(4)');
207  $this->‪openAndCloseTheEditForm($I, $username);
208  }
209 
214  private function ‪checkCountOfUsers(‪BackendTester $I, int $countOfUsers)
215  {
216  $I->canSeeNumberOfElements('#typo3-backend-user-list tbody tr', $countOfUsers);
217  $I->wantToTest('If a number of users is shown in the footer row');
218  $I->canSeeNumberOfElements('#typo3-backend-user-list tfoot tr', 1);
219  $I->see($countOfUsers . ' Users', '#typo3-backend-user-list tfoot tr');
220  }
221 
226  private function ‪openAndCloseTheEditForm(‪BackendTester $I, string $username): void
227  {
228  $I->waitForElementNotVisible('#t3js-ui-block');
229  $I->canSee('Edit Backend user "' . $username . '" on root level');
230 
231  $I->click('div.module-docheader .btn.t3js-editform-close');
232  $I->waitForElementVisible('table.table-striped');
233  $I->canSee('Backend User Listing', 'h1');
234  }
235 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\checkCountOfUsers
‪checkCountOfUsers(BackendTester $I, int $countOfUsers)
Definition: ListUserCest.php:214
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\showsHeadingAndListsBackendUsers
‪showsHeadingAndListsBackendUsers(BackendTester $I)
Definition: ListUserCest.php:41
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest
Definition: ListUserCest.php:24
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\canEditUsersFromIndexListView
‪canEditUsersFromIndexListView(BackendTester $I)
Definition: ListUserCest.php:192
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByLogin
‪filterUsersByLogin(BackendTester $I)
Definition: ListUserCest.php:142
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByUserGroup
‪filterUsersByUserGroup(BackendTester $I)
Definition: ListUserCest.php:171
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByUsername
‪filterUsersByUsername(BackendTester $I)
Definition: ListUserCest.php:55
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByAdmin
‪filterUsersByAdmin(BackendTester $I)
Definition: ListUserCest.php:84
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\openAndCloseTheEditForm
‪openAndCloseTheEditForm(BackendTester $I, string $username)
Definition: ListUserCest.php:226
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\_before
‪_before(BackendTester $I)
Definition: ListUserCest.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser
Definition: CompareUserCest.php:3
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser\ListUserCest\filterUsersByStatus
‪filterUsersByStatus(BackendTester $I)
Definition: ListUserCest.php:113