CompareUserCest.php 4.26 KB
Newer Older
1
<?php
2

3
declare(strict_types=1);
4
5
6
7
8
9
10
11
12
13
14
15
16
17

/*
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */

18
namespace TYPO3\CMS\Core\Tests\Acceptance\Application\BackendUser;
19

20
use TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester;
21
22
23
24
25
26
27

/**
 * Tests concerning the compare view of BE user module
 */
class CompareUserCest
{
    /**
28
     * @param ApplicationTester $I
29
     */
30
    public function _before(ApplicationTester $I): void
31
    {
Davert's avatar
Davert committed
32
        $I->useExistingSession('admin');
33

34
35
        $I->see('Backend Users');
        $I->click('Backend Users');
36
        $I->switchToContentFrame();
37
38
39
    }

    /**
40
     * @param ApplicationTester $I
41
     */
42
    public function editingBeUserRecordsFromCompareViewWorks(ApplicationTester $I): void
43
44
45
46
47
48
    {
        // put two users into compare list
        $I->see('Backend User Listing');
        $I->click('#typo3-backend-user-list > tbody > tr:nth-child(1) > td.col-control > div:nth-child(3) > a');
        $I->waitForElementVisible('table#typo3-backend-user-list');
        $I->click('#typo3-backend-user-list > tbody > tr:nth-child(2) > td.col-control > div:nth-child(3) > a');
Davert's avatar
Davert committed
49
        $I->waitForElementVisible('table#typo3-backend-user-list-compare', 20);
50
        $I->canSeeNumberOfElements('#typo3-backend-user-list-compare tbody tr', 2);
51
        $I->click('body > div > div.module-body.t3js-module-body .compare');
52
53
54
55
        $I->waitForElementVisible('table.table-striped');

        // first user can be edited
        $usernameFirstCompare = $I->grabTextFrom('#tx_beuser_compare > thead > tr > th:nth-child(2)');
56
        $I->click('#tx_beuser_compare > thead > tr > th:nth-child(2) > a[title="edit"]');
57
58
59
60
61
        $I->waitForElementNotVisible('#t3js-ui-block');
        $I->waitForElementVisible('#EditDocumentController');
        $I->canSee('Edit Backend user "' . $usernameFirstCompare . '" on root level');

        // back to compare view
62
        $I->click('.module-docheader a[title="Close"]');
63
64
65
66
67
        $I->waitForElementVisible('table.table-striped');
        $I->canSee('Compare backend users', 'h1');

        // second user can be edited
        $usernameFirstCompare = $I->grabTextFrom('#tx_beuser_compare > thead > tr > th:nth-child(3)');
68
        $I->click('#tx_beuser_compare > thead > tr > th:nth-child(3) > a[title="edit"]');
69
70
71
72
        $I->waitForElementNotVisible('#t3js-ui-block');
        $I->waitForElementVisible('#EditDocumentController');
        $I->canSee('Edit Backend user "' . $usernameFirstCompare . '" on root level');
    }
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

    /**
     * @param ApplicationTester $I
     */
    public function accessingBackendUserCompareViewWorks(ApplicationTester $I): void
    {
        $I->amGoingTo('Switch to user group listing');
        $I->see('Backend User Listing', 'h1');
        $I->selectOption('.t3-js-jumpMenuBox', 'Backend user groups');
        $I->see('Backend User Group Listing', 'h1');

        $I->amGoingTo('Add three groups to compare');
        $I->click('#typo3-backend-user-group-list > tbody > tr:nth-child(1) > td.col-control > div:nth-child(3) > a');
        $I->waitForElementVisible('table#typo3-backend-user-group-list');
        $I->click('#typo3-backend-user-group-list > tbody > tr:nth-child(2) > td.col-control > div:nth-child(3) > a');
        $I->waitForElementVisible('table#typo3-backend-user-group-list');
        $I->click('#typo3-backend-user-group-list > tbody > tr:nth-child(3) > td.col-control > div:nth-child(3) > a');

        $I->amGoingTo('Access the user group compare view');
        $I->waitForElementVisible('table#typo3-backend-user-list-compare', 20);
        $I->canSeeNumberOfElements('#typo3-backend-user-list-compare tbody tr', 3);
        $I->click('Compare backend usergroups');

        $I->amGoingTo('Check compare view is loaded with the correct number of groups');
        $I->see('Compare backend usergroups', 'h1');
        // We expect four header columns, since the first one is used for the row labels
        $I->canSeeNumberOfElements('#tx_beuser_compare > thead > tr > th', 4);
    }
101
}