1fbf884eb475a1921c7d4d203476d08f39a4af04
[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 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
33 $I->switchToIFrame('list_frame');
34 $I->waitForText('Web Content Management System');
35 $I->switchToIFrame();
36
37 $I->see('Backend users');
38 $I->click('Backend users');
39
40 // switch to content iframe
41 $I->switchToIFrame('list_frame');
42 $I->waitForElementNotVisible('div#nprogess');
43 $I->selectOption('div.module-docheader select.t3-js-jumpMenuBox', 'Backend user groups');
44 $I->waitForElementVisible('table.table-striped');
45 $I->canSee('Backend User Group Listing', 'h1');
46 }
47
48 public function canEditBeGroupsFromListView(Admin $I)
49 {
50 $groupname = $I->grabTextFrom('table.table-striped > tbody > tr:nth-child(1) > td.col-title > a > b');
51
52 $I->amGoingTo('test edit on group name');
53 $I->click('table.table-striped > tbody > tr:nth-child(1) > td.col-title > a');
54 $this->openAndCloseTheEditForm($I, $groupname);
55
56 $I->amGoingTo('test edit on edit button');
57 $I->click('table.table-striped > tbody > tr:nth-child(1) > td.col-control > div:nth-child(1) > a:nth-child(1)');
58 $this->openAndCloseTheEditForm($I, $groupname);
59 }
60
61 /**
62 * @param Admin $I
63 */
64 public function canEditSubGroupFromListView(Admin $I)
65 {
66 $I->amGoingTo('test the subgroup edit form');
67 $groupname = $I->grabTextFrom('table.table-striped > tbody > tr:nth-child(2) > td:nth-child(3) > a:nth-child(1)');
68 $I->click('table.table-striped > tbody > tr:nth-child(2) > td:nth-child(3) > a:nth-child(1)');
69 $this->openAndCloseTheEditForm($I, $groupname);
70 }
71
72 /**
73 * @param Admin $I
74 * @param string $groupname
75 */
76 private function openAndCloseTheEditForm(Admin $I, string $groupname): void
77 {
78 $I->waitForElementNotVisible('#t3js-ui-block');
79 $I->canSee('Edit Backend usergroup "' . $groupname . '" on root level');
80
81 $I->click('div.module-docheader .btn.t3js-editform-close');
82 $I->waitForElementVisible('table.table-striped');
83 $I->canSee('Backend User Group Listing', 'h1');
84 }
85 }