‪TYPO3CMS  11.5
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 
25 {
26  public 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 
41  public function ‪seeExtensionConfiguration(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
42  {
43  $logoAltText = 'TYPO3 logo alt text';
44  $inputAltText = '#em-backend-loginLogoAlt';
45  $button = 'Configure extensions';
46  $modalSave = 'Save "backend" configuration';
47  $panel = 'backend';
48 
49  // Open modal, change alt text and save
50  $I->click($button);
51  $modalDialog->‪canSeeDialog();
52  $I->amGoingTo('open the backend panel');
53  $I->click($panel, '.panel-heading');
54  $I->waitForElement($inputAltText);
55  $previousLogoAltText = $I->grabValueFrom($inputAltText);
56  $I->amGoingTo('fill in an alt text for the logo');
57  $I->fillField($inputAltText, $logoAltText);
58  $I->click($modalSave, ‪ModalDialog::$openedModalSelector);
60 
61  // Open modal, reset alt text and save
62  $I->amGoingTo('see saved alt text and reset the alt text for the logo');
63  $I->click($button);
64  $modalDialog->‪canSeeDialog();
65  $I->click($panel, '.panel-heading');
66  $I->waitForElement($inputAltText);
67  $value = $I->grabValueFrom($inputAltText);
68  $I->assertEquals($logoAltText, $value);
69  $I->fillField($inputAltText, $previousLogoAltText);
70  $I->click($modalSave, ‪ModalDialog::$openedModalSelector);
72  }
73 
78  {
79  $expectedInitialPasswordValue = '';
80 
81  $I->click('Change Install Tool Password');
82  $modalDialog->‪canSeeDialog();
83 
84  $I->amGoingTo('check if password fields are initially empty');
85  $passwordValue = $I->grabValueFrom('#t3-install-tool-password');
86  $I->assertEquals($expectedInitialPasswordValue, $passwordValue);
87  $passwordRepeatValue = $I->grabValueFrom('#t3-install-tool-password-repeat');
88  $I->assertEquals($expectedInitialPasswordValue, $passwordRepeatValue);
89 
90  $I->amGoingTo('change the install tool password');
91  $I->fillField('#t3-install-tool-password', self::INSTALL_TOOL_PASSWORD);
92  $I->fillField('#t3-install-tool-password-repeat', self::INSTALL_TOOL_PASSWORD);
93 
94  $I->click('Set new password', ‪ModalDialog::$openedModalButtonContainerSelector);
95  $I->waitForText('Install tool password changed', 5, self::$alertContainerSelector);
97  }
98 
102  public function ‪seeManageSystemMaintainers(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
103  {
104  $button = 'Manage System Maintainers';
105  $modalSave = 'Save system maintainer list';
106 
107  $I->amGoingTo('add a system maintainer to the list');
108  $I->click($button);
109  $modalDialog->‪canSeeDialog();
110  $I->click('.chosen-search-input', ‪ModalDialog::$openedModalSelector);
111 
112  // Select first user in list - "admin"
113  $I->amGoingTo('select first user in list');
114  $I->click('.active-result[data-option-array-index="0"]', '.chosen-results');
116  $I->waitForText('Updated system maintainers', 5, self::$alertContainerSelector);
118 
119  $I->amGoingTo('remove the maintainer from the list');
120  $I->click($button);
121  $modalDialog->‪canSeeDialog();
122  // Wait for current list of maintainers to appear
123  $I->waitForElementVisible('.search-choice-close', 5);
124  $I->click('.search-choice-close', ‪ModalDialog::$openedModalSelector);
125  $I->waitForElementNotVisible('.search-choice', 5);
127  $I->waitForText('Cleared system maintainer list', 5, self::$alertContainerSelector);
129  }
130 
134  public function ‪seeConfigurationPresets(‪ApplicationTester $I, ‪ModalDialog $modalDialog): void
135  {
136  $button = 'Choose Preset';
137  $modalButton = 'Activate preset';
138  $expectedFlashMessageText = 'Configuration written';
139 
140  $I->click($button);
141  $modalDialog->‪canSeeDialog();
142 
143  $I->click('Cache settings', '.panel-heading');
144  $I->waitForElement('#t3-install-tool-configuration-cache-file');
145 
146  $I->amGoingTo('change cache configuration and save configuration');
147  $I->click('#t3-install-tool-configuration-cache-file');
149  $I->waitForText($expectedFlashMessageText, 5, self::$alertContainerSelector);
151 
152  $I->click($button);
153  $modalDialog->‪canSeeDialog();
154 
155  // Check if value was saved as expected
156  $fileCacheValue = $I->grabValueFrom('#t3-install-tool-configuration-cache-file');
157  $I->assertEquals('File', $fileCacheValue);
158 
159  // Reset cache to custom configuration
160  $I->click('Cache settings', '.panel-heading');
161  $I->waitForElement('#t3-install-tool-configuration-cache-database');
162  $I->amGoingTo('change and save the cache configuration');
163  $I->click('#t3-install-tool-configuration-cache-custom');
165  $I->waitForText($expectedFlashMessageText, 5, self::$alertContainerSelector);
167  }
168 
172  public function ‪seeFeatureToggles(‪ApplicationTester $I, ‪ModalDialog $modalDialog, Scenario $scenario): void
173  {
174  $button = 'Configure Features';
175  $modalButton = 'Save';
176  $featureToggle = '#t3-install-tool-features-redirects.hitCount';
177 
178  // Switch hit count feature toggle
179  $I->click($button);
180  $modalDialog->‪canSeeDialog();
181  $I->amGoingTo('change hit count feature toggle and save it');
182  $I->click($featureToggle);
184  $I->waitForText('Features updated', 5, self::$alertContainerSelector);
186 
187  // Switch back hit count feature toggle
188  $I->click($button);
189  $modalDialog->‪canSeeDialog();
190  if (str_contains($scenario->current('env'), 'classic')) {
191  // ['features']['redirects.hitCount'] is enabled by default in classic mode (set by TF BackendEnvironment setup)
192  $I->cantSeeCheckboxIsChecked($featureToggle);
193  } else {
194  $I->canSeeCheckboxIsChecked($featureToggle);
195  }
196  $I->amGoingTo('reset hit count feature toggle and save it');
197  $I->click($featureToggle);
200  }
201 
206  {
207  $button = 'Configure options';
208  $panel = 'Backend';
209  $checkbox = '#BE_languageDebug';
210  $modalButton = 'Write configuration';
211  $expectedFlashMessageText = 'BE/languageDebug';
212 
213  // Activate [BE][languageDebug]
214  $I->click($button);
215  $modalDialog->‪canSeeDialog();
216  $I->amGoingTo('open the backend panel');
217  $I->click($panel, '.panel-heading');
218  $I->waitForElement($checkbox);
219  $I->amGoingTo('tick the checkbox [BE][languageDebug] option');
220  $I->click($checkbox);
222  $I->waitForText($expectedFlashMessageText, 5, self::$alertContainerSelector);
224 
225  // Reset [BE][languageDebug]
226  $I->click($button);
227  $modalDialog->‪canSeeDialog();
228  $I->click($panel, '.panel-heading');
229  $I->waitForElement($checkbox);
230  $I->seeCheckboxIsChecked($checkbox);
231  $I->amGoingTo('reset [BE][languageDebug] checkbox');
232  $I->click($checkbox);
235  }
236 
238  {
239  // We need to close the flash message here to be able to close the modal
240  $I->click('.close', self::$alertContainerSelector);
241  $I->click('.t3js-modal-close');
242  }
243 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalSelector
‪static string $openedModalSelector
Definition: ModalDialog.php:33
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeExtensionConfiguration
‪seeExtensionConfiguration(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:41
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeManageSystemMaintainers
‪seeManageSystemMaintainers(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:102
‪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:27
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalButtonContainerSelector
‪static string $openedModalButtonContainerSelector
Definition: ModalDialog.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeFeatureToggles
‪seeFeatureToggles(ApplicationTester $I, ModalDialog $modalDialog, Scenario $scenario)
Definition: SettingsCest.php:172
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeConfigurationPresets
‪seeConfigurationPresets(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:134
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\logIntoInstallTool
‪logIntoInstallTool(ApplicationTester $I)
Definition: AbstractCest.php:58
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeConfigureInstallationWideOptions
‪seeConfigureInstallationWideOptions(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:205
‪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:73
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\closeModalAndHideFlashMessage
‪closeModalAndHideFlashMessage(ApplicationTester $I)
Definition: SettingsCest.php:237
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\SettingsCest\seeChangeInstallToolPassword
‪seeChangeInstallToolPassword(ApplicationTester $I, ModalDialog $modalDialog)
Definition: SettingsCest.php:77