‪TYPO3CMS  ‪main
SettingsCest.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 
20 use Codeception\Scenario;
23 
24 final class ‪SettingsCest extends ‪AbstractCest
25 {
26  private static string ‪$alertContainerSelector = '#alert-container';
27 
28  public function ‪_before(‪ApplicationTester $I): void
29  {
30  parent::_before($I);
31  $this->‪logIntoInstallTool($I);
32  $I->click('Settings');
33  $I->see('Settings', 'h1');
34  }
35 
36  public function ‪seeExtensionConfiguration(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
37  {
38  $logoAltText = 'TYPO3 logo alt text';
39  $inputAltText = '#em-backend-loginLogoAlt';
40  $button = 'Configure extensions…';
41  $modalSave = 'Save "backend" configuration';
42  $panel = 'backend';
43 
44  // Open modal, change alt text and save
45  $I->click($button);
46  $modalDialog->‪canSeeDialog();
47  $I->amGoingTo('open the backend panel');
48  $I->click($panel, '.panel-heading');
49  $I->waitForElement($inputAltText);
50  $previousLogoAltText = $I->grabValueFrom($inputAltText);
51  $I->amGoingTo('fill in an alt text for the logo');
52  $I->fillField($inputAltText, $logoAltText);
53  $I->click($modalSave, ‪ModalDialog::$openedModalSelector);
55 
56  // Open modal, reset alt text and save
57  $I->amGoingTo('see saved alt text and reset the alt text for the logo');
58  $I->click($button);
59  $modalDialog->‪canSeeDialog();
60  $I->click($panel, '.panel-heading');
61  $I->waitForElement($inputAltText);
62  $value = $I->grabValueFrom($inputAltText);
63  $I->assertEquals($logoAltText, $value);
64  $I->fillField($inputAltText, $previousLogoAltText);
65  $I->click($modalSave, ‪ModalDialog::$openedModalSelector);
67  }
68 
70  {
71  $expectedInitialPasswordValue = '';
72 
73  $I->click('Change Install Tool Password…');
74  $modalDialog->‪canSeeDialog();
75 
76  $I->amGoingTo('check if password fields are initially empty');
77  $passwordValue = $I->grabValueFrom('#t3-install-tool-password');
78  $I->assertEquals($expectedInitialPasswordValue, $passwordValue);
79  $passwordRepeatValue = $I->grabValueFrom('#t3-install-tool-password-repeat');
80  $I->assertEquals($expectedInitialPasswordValue, $passwordRepeatValue);
81 
82  $I->amGoingTo('change the install tool password');
83  $I->fillField('#t3-install-tool-password', self::INSTALL_TOOL_PASSWORD);
84  $I->fillField('#t3-install-tool-password-repeat', self::INSTALL_TOOL_PASSWORD);
85 
86  $I->click('Set new password', ‪ModalDialog::$openedModalButtonContainerSelector);
87  $I->waitForText('Install tool password changed', 5, self::$alertContainerSelector);
89  }
90 
91  public function ‪seeManageSystemMaintainers(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
92  {
93  $button = 'Manage System Maintainers…';
94  $modalSave = 'Save system maintainer list';
95 
96  $I->amGoingTo('add a system maintainer to the list');
97  $I->click($button);
98  $modalDialog->‪canSeeDialog();
99  $I->executeJS("document.querySelector('" . ‪ModalDialog::$openedModalSelector . " select-pure').shadowRoot.querySelector('.label').click()");
100 
101  // Select first user in list - "admin"
102  $I->amGoingTo('select first user in list');
103  $I->executeJS("document.querySelector('" . ‪ModalDialog::$openedModalSelector . " select-pure').querySelector('option-pure').shadowRoot.querySelector('.option').click()");
105  $I->waitForText('Updated system maintainers', 5, self::$alertContainerSelector);
107 
108  $I->amGoingTo('remove the maintainer from the list');
109  $I->click($button);
110  $modalDialog->‪canSeeDialog();
111  // Wait for current list of maintainers to appear
112  $I->waitForElement('option-pure[selected]', 5);
113  $I->executeJS("document.querySelector('" . ‪ModalDialog::$openedModalSelector . " select-pure').shadowRoot.querySelector('.multi-selected .cross').click()");
114  $I->waitForElement('option-pure:not([selected])', 5);
116  $I->waitForText('Cleared system maintainer list', 5, self::$alertContainerSelector);
118  }
119 
120  public function ‪seeConfigurationPresets(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
121  {
122  $button = 'Choose Preset…';
123  $modalButton = 'Activate preset';
124  $expectedFlashMessageText = 'Configuration written';
125 
126  $I->click($button);
127  $modalDialog->‪canSeeDialog();
128 
129  $I->click('Cache settings', '.panel-heading');
130  $I->waitForElement('#t3-install-tool-configuration-cache-file');
131 
132  $I->amGoingTo('change cache configuration and save configuration');
133  $I->click('#t3-install-tool-configuration-cache-file');
135  $I->waitForText($expectedFlashMessageText, 5, self::$alertContainerSelector);
137 
138  $I->click($button);
139  $modalDialog->‪canSeeDialog();
140 
141  // Check if value was saved as expected
142  $fileCacheValue = $I->grabValueFrom('#t3-install-tool-configuration-cache-file');
143  $I->assertEquals('File', $fileCacheValue);
144 
145  // Reset cache to custom configuration
146  $I->click('Cache settings', '.panel-heading');
147  $I->waitForElement('#t3-install-tool-configuration-cache-database');
148  $I->amGoingTo('change and save the cache configuration');
149  $I->click('#t3-install-tool-configuration-cache-custom');
151  $I->waitForText($expectedFlashMessageText, 5, self::$alertContainerSelector);
153  }
154 
155  public function ‪seeFeatureToggles(‪ApplicationTester $I, ‪ModalDialog $modalDialog, Scenario $scenario): void
156  {
157  $button = 'Configure Features…';
158  $modalButton = 'Save';
159  $featureToggle = '#t3-install-tool-features-redirects.hitCount';
160 
161  // Switch hit count feature toggle
162  $I->click($button);
163  $modalDialog->‪canSeeDialog();
164  $I->amGoingTo('change hit count feature toggle and save it');
165  $I->click($featureToggle);
167  $I->waitForText('Features updated', 5, self::$alertContainerSelector);
169 
170  // Switch back hit count feature toggle
171  $I->click($button);
172  $modalDialog->‪canSeeDialog();
173  if (str_contains($scenario->current('env'), 'classic')) {
174  // ['features']['redirects.hitCount'] is enabled by default in classic mode (set by TF BackendEnvironment setup)
175  $I->cantSeeCheckboxIsChecked($featureToggle);
176  } else {
177  $I->canSeeCheckboxIsChecked($featureToggle);
178  }
179  $I->amGoingTo('reset hit count feature toggle and save it');
180  $I->click($featureToggle);
183  }
184 
186  {
187  $button = 'Configure options…';
188  $panel = 'Backend';
189  $checkbox = '#BE_lockSSL';
190  $modalButton = 'Write configuration';
191  $expectedFlashMessageText = 'BE/lockSSL';
192 
193  // Activate [BE][lockSSL]
194  $I->click($button);
195  $modalDialog->‪canSeeDialog();
196  $I->amGoingTo('open the backend panel');
197  $I->click($panel, '.panel-heading');
198  $I->waitForElement($checkbox);
199  $I->amGoingTo('tick the checkbox [BE][lockSSL] option');
200  $I->click($checkbox);
202  $I->waitForText($expectedFlashMessageText, 5, self::$alertContainerSelector);
204 
205  // Reset [BE][lockSSL]
206  $I->click($button);
207  $modalDialog->‪canSeeDialog();
208  $I->click($panel, '.panel-heading');
209  $I->waitForElement($checkbox);
210  $I->seeCheckboxIsChecked($checkbox);
211  $I->amGoingTo('reset [BE][lockSSL] checkbox');
212  $I->click($checkbox);
215  }
216 
218  {
219  // We need to close the flash message here to be able to close the modal
220  $I->click('.close', self::$alertContainerSelector);
221  $I->click('.t3js-modal-close');
222  }
223 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalSelector
‪static string $openedModalSelector
Definition: ModalDialog.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeExtensionConfiguration
‪seeExtensionConfiguration(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:36
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeManageSystemMaintainers
‪seeManageSystemMaintainers(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:91
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest
Definition: SettingsCest.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\$alertContainerSelector
‪static string $alertContainerSelector
Definition: SettingsCest.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalButtonContainerSelector
‪static string $openedModalButtonContainerSelector
Definition: ModalDialog.php:37
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeFeatureToggles
‪seeFeatureToggles(ApplicationTester $I, ModalDialog $modalDialog, Scenario $scenario)
Definition: SettingsCest.php:155
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeConfigurationPresets
‪seeConfigurationPresets(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:120
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\logIntoInstallTool
‪logIntoInstallTool(ApplicationTester $I)
Definition: AbstractCest.php:57
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeConfigureInstallationWideOptions
‪seeConfigureInstallationWideOptions(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:185
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\_before
‪_before(ApplicationTester $I)
Definition: SettingsCest.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool
Definition: AbstractCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest
Definition: AbstractCest.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\canSeeDialog
‪canSeeDialog()
Definition: ModalDialog.php:68
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\closeModalAndHideFlashMessage
‪closeModalAndHideFlashMessage(ApplicationTester $I)
Definition: SettingsCest.php:217
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:24
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeChangeInstallToolPassword
‪seeChangeInstallToolPassword(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:69