[TASK] Stabilize acceptance tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / BackendUser / ListGroupCest.php
1 <?php
2 declare(strict_types = 1);
3
4 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\BackendUser;
5
6 /*
7 * This file is part of the TYPO3 CMS project.
8 *
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
12 *
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
15 *
16 * The TYPO3 project - inspiring people to share!
17 */
18
19 use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
20
21 /**
22 * Tests concerning the listing of BeUser groups
23 */
24 class ListGroupCest
25 {
26 /**
27 * @param Admin $I
28 */
29 public function _before(Admin $I)
30 {
31 $I->useExistingSession();
32
33 $I->see('Backend users');
34 $I->click('Backend users');
35
36 $I->switchToContentFrame();
37 $I->selectOption('div.module-docheader select.t3-js-jumpMenuBox', 'Backend user groups');
38 $I->waitForElementVisible('table.table-striped');
39 $I->canSee('Backend User Group Listing', 'h1');
40 }
41
42 public function canEditBeGroupsFromListView(Admin $I)
43 {
44 $groupname = $I->grabTextFrom('table.table-striped > tbody > tr:nth-child(1) > td.col-title > a > b');
45
46 $I->amGoingTo('test edit on group name');
47 $I->click('table.table-striped > tbody > tr:nth-child(1) > td.col-title > a');
48 $this->openAndCloseTheEditForm($I, $groupname);
49
50 $I->amGoingTo('test edit on edit button');
51 $I->click('table.table-striped > tbody > tr:nth-child(1) > td.col-control > div:nth-child(1) > a:nth-child(1)');
52 $this->openAndCloseTheEditForm($I, $groupname);
53 }
54
55 /**
56 * @param Admin $I
57 */
58 public function canEditSubGroupFromListView(Admin $I)
59 {
60 $I->amGoingTo('test the subgroup edit form');
61 $groupname = $I->grabTextFrom('table.table-striped > tbody > tr:nth-child(2) > td:nth-child(3) > a:nth-child(1)');
62 $I->click('table.table-striped > tbody > tr:nth-child(2) > td:nth-child(3) > a:nth-child(1)');
63 $this->openAndCloseTheEditForm($I, $groupname);
64 }
65
66 /**
67 * @param Admin $I
68 * @param string $groupname
69 */
70 private function openAndCloseTheEditForm(Admin $I, string $groupname): void
71 {
72 $I->waitForText('Edit Backend usergroup "' . $groupname . '" on root level', 120);
73 $I->see('Edit Backend usergroup "' . $groupname . '" on root level', 'h1');
74
75 $I->click('div.module-docheader .btn.t3js-editform-close');
76 $I->waitForElementVisible('table.table-striped');
77 $I->waitForText('Backend User Group Listing', 120);
78 $I->see('Backend User Group Listing', 'h1');
79 }
80 }