2 declare(strict_types
= 1);
4 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler
;
7 * This file is part of the TYPO3 CMS project.
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.
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
16 * The TYPO3 project - inspiring people to share!
19 use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin
;
20 use TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree
;
25 class FalMetadataInheritanceCest
27 public function _before(Admin
$I, PageTree
$pageTree)
29 $I->useExistingSession();
30 $this->goToPageModule($I, $pageTree);
34 * This scenario tests whether updated sys_file_metadata fields are propagated to sys_file_reference
35 * attached to tt_content
36 * - creates tt_content
37 * - attaches an image with empty metadata
38 * - modifies image metadata
39 * - checks if metadata is propagated to tt_content
42 * @param PageTree $pageTree
45 public function checkIfUpdatedFileMetadataIsUpdatedInContent(Admin
$I, PageTree
$pageTree)
47 $I->amGoingTo('Create new CE with image');
48 $I->click('.t3js-page-new-ce a');
49 $I->switchToMainFrame();
50 $I->waitForElement('.t3js-modal.in');
52 $I->waitForElementNotVisible('div#nprogess');
53 $I->click('Text & Images');
54 $I->switchToContentFrame();
55 $I->waitForText('Create new Page Content on page');
56 $I->fillField('//input[contains(@data-formengine-input-name, "data[tt_content]") and contains(@data-formengine-input-name, "[header]")]', 'tt_content with image');
59 $I->click('Add image');
61 $I->switchToIFrame('modal_frame');
62 $I->click('.list-tree-control-closed');
63 $I->click('styleguide');
64 $I->click('bus_lane.jpg');
66 $I->switchToContentFrame();
67 $I->waitForText('bus_lane.jpg');
69 $I->see('Set element specific value (No default)', '.t3js-form-field-eval-null-placeholder-checkbox');
71 $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', ['placeholder' => '', 'value' => '']);
72 $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', ['placeholder' => '', 'value' => '']);
73 $I->seeElementInDOM('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', ['placeholder' => '']);
74 //textarea value is not in the attribute, so we need to check it separately
75 $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
77 $I->click('button[name="_savedok"]');
79 $I->click('a[title="Close"]');
81 $I->amGoingTo('Change default metadata');
82 $I->switchToMainFrame();
83 $I->click('Filelist');
84 $I->switchToIFrame('typo3-navigationContainerIframe');
85 $I->waitForText('fileadmin/ (auto-created)');
86 $I->click('styleguide');
89 $I->switchToContentFrame();
90 $I->click('bus_lane.jpg');
91 $I->waitForText('Edit File Metadata "bus_lane.jpg" on root level');
92 $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[title]")]', 'Test title');
93 $I->fillField('//textarea[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[description]")]', 'Test description');
94 $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[alternative]")]', 'Test alternative');
96 $I->click('button[name="_savedok"]');
98 $I->click('a[title="Close"]');
100 $I->amGoingTo('Check metadata of sys_file_reference displayed in tt_content');
101 $this->goToPageModule($I, $pageTree);
102 $I->switchToWindow();
103 $I->switchToContentFrame();
104 $I->click('tt_content with image');
105 $I->waitForElementNotVisible('#t3js-ui-block');
106 $I->waitForText('Edit Page Content "tt_content with image" on page "styleguide TCA demo"');
108 $I->click('.form-irre-header');
110 $I->see('(Default: "Test title")', '.t3js-form-field-eval-null-placeholder-checkbox');
111 $I->see('(Default: "Test alternative")', '.t3js-form-field-eval-null-placeholder-checkbox');
112 $I->see('(Default: "Test description")', '.t3js-form-field-eval-null-placeholder-checkbox');
114 $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', ['placeholder' => 'Test title', 'value' => '']);
115 $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', ['placeholder' => 'Test alternative', 'value' => '']);
116 $I->seeElementInDOM('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', ['placeholder' => 'Test description']);
117 //textarea value is not in the attribute, so we need to check it separately
118 $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
122 * This scenario tests whether sys_file_metadata fields are propagated to sys_file_reference
123 * attached to tt_content
125 * - given a image with filled metadata (created in checkIfUpdatedFileMetadataIsUpdatedInContent test)
126 * - creates a new tt_content
127 * - attaches an image to tt_content
128 * - checks if metadata is propagated to tt_content
129 * - checks if checkboxes are unchecked and inputs are disabled
131 * test for https://forge.typo3.org/issues/81235
134 * @param PageTree $pageTree
136 * @depends checkIfUpdatedFileMetadataIsUpdatedInContent
138 public function checkIfFileMetadataIsInheritedInContent(Admin
$I)
140 $I->amGoingTo('Create new CE with image with filled metadata');
141 $I->click('.t3js-page-new-ce a');
142 $I->switchToMainFrame();
143 $I->waitForElement('.t3js-modal.in');
145 $I->waitForElementNotVisible('div#nprogess');
146 $I->click('Text & Images');
147 $I->switchToContentFrame();
148 $I->waitForText('Create new Page Content on page');
149 $I->fillField('//input[contains(@data-formengine-input-name, "data[tt_content]") and contains(@data-formengine-input-name, "[header]")]', 'tt_content with image with filled metadata');
152 $I->click('Add image');
153 $I->switchToWindow();
154 $I->switchToIFrame('modal_frame');
155 $I->click('.list-tree-control-closed');
156 $I->click('styleguide');
157 $I->click('bus_lane.jpg');
158 $I->switchToWindow();
159 $I->switchToContentFrame();
160 $I->waitForText('bus_lane.jpg');
162 $I->waitForText('Image Metadata');
164 $I->seeInField('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', '');
165 $I->seeInField('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', '');
166 $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
168 $I->see('(Default: "Test title")', '.t3js-form-field-eval-null-placeholder-checkbox');
169 $I->see('(Default: "Test alternative")', '.t3js-form-field-eval-null-placeholder-checkbox');
170 $I->see('(Default: "Test description")', '.t3js-form-field-eval-null-placeholder-checkbox');
172 $I->amGoingTo('assert checkboxes are not checked');
173 $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[title]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
174 $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[alternative]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
175 $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[description]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
177 $I->amGoingTo('Assert hidden control field value (default value which is used when checkbox is not checked');
178 $I->seeInField('//input[contains(@name, "[title]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
179 $I->seeInField('//input[contains(@name, "[alternative]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
180 $I->seeInField('//input[contains(@name, "[description]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
182 //when checkbox is unchecked the disabled input is shown
183 //<input type="text" class="form-control" disabled="disabled" value="Test title">
184 $I->seeInField('input.form-control:disabled', 'Test title');
185 $I->seeInField('input.form-control:disabled', 'Test alternative');
186 $I->seeInField('textarea.form-control:disabled', 'Test description');
191 * @param PageTree $pageTree
194 protected function goToPageModule(Admin
$I, PageTree
$pageTree)
197 $I->waitForElement('svg .nodes .node');
198 $pageTree->openPath(['styleguide TCA demo']);
199 $I->switchToContentFrame();
200 $I->waitForText('styleguide TCA demo');