‪TYPO3CMS  9.5
FalMetadataInheritanceCest.php
Go to the documentation of this file.
1 <?php
2 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 
20 
25 {
32  public function ‪_before(‪BackendTester $I, ‪PageTree $pageTree)
33  {
34  $I->useExistingSession('admin');
35  $this->‪goToPageModule($I, $pageTree);
36  }
37 
51  {
52  $I->amGoingTo('Create new CE with image');
53  $I->click('.t3js-page-new-ce a');
54  $I->switchToMainFrame();
55  $I->waitForElement('.t3js-modal.in');
56  $I->wait(3);
57  $I->waitForElementNotVisible('div#nprogess');
58  $I->click('Text & Images');
59  $I->switchToContentFrame();
60  $I->waitForText('Create new Page Content on page');
61  $I->fillField('//input[contains(@data-formengine-input-name, "data[tt_content]") and contains(@data-formengine-input-name, "[header]")]', 'tt_content with image');
62 
63  $I->click('Images');
64  $I->click('Add image');
65  $I->switchToWindow();
66  $I->switchToIFrame('modal_frame');
67  $I->click('.list-tree-control-closed');
68  $I->click('styleguide');
69  $I->click('bus_lane.jpg');
70  $I->switchToWindow();
71  $I->switchToContentFrame();
72  $I->waitForText('bus_lane.jpg');
73 
74  $I->see('Set element specific value (No default)', '.t3js-form-field-eval-null-placeholder-checkbox');
75 
76  $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', ['placeholder' => '', 'value' => '']);
77  $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', ['placeholder' => '', 'value' => '']);
78  $I->seeElementInDOM('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', ['placeholder' => '']);
79  //textarea value is not in the attribute, so we need to check it separately
80  $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
81 
82  $I->click('button[name="_savedok"]');
83  $I->wait(3);
84  $I->click('a[title="Close"]');
85 
86  $I->amGoingTo('Change default metadata');
87  $I->switchToMainFrame();
88  $I->click('Filelist');
89  $I->switchToIFrame('typo3-navigationContainerIframe');
90  $I->waitForText('fileadmin/ (auto-created)');
91  $I->click('styleguide');
92 
93  $I->switchToWindow();
94  $I->switchToContentFrame();
95  $I->click('bus_lane.jpg');
96  $I->waitForText('Edit File Metadata "bus_lane.jpg" on root level');
97  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[title]")]', 'Test title');
98  $I->fillField('//textarea[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[description]")]', 'Test description');
99  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[alternative]")]', 'Test alternative');
100 
101  $I->click('button[name="_savedok"]');
102  $I->wait(3);
103  $I->click('a[title="Close"]');
104 
105  $I->amGoingTo('Check metadata of sys_file_reference displayed in tt_content');
106  $this->‪goToPageModule($I, $pageTree);
107  $I->switchToWindow();
108  $I->switchToContentFrame();
109  $I->click('tt_content with image');
110  $I->waitForElementNotVisible('#t3js-ui-block');
111  $I->waitForText('Edit Page Content "tt_content with image" on page "styleguide TCA demo"');
112  $I->click('Images');
113  $I->click('.form-irre-header');
114 
115  $I->see('(Default: "Test title")', '.t3js-form-field-eval-null-placeholder-checkbox');
116  $I->see('(Default: "Test alternative")', '.t3js-form-field-eval-null-placeholder-checkbox');
117  $I->see('(Default: "Test description")', '.t3js-form-field-eval-null-placeholder-checkbox');
118 
119  $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', ['placeholder' => 'Test title', 'value' => '']);
120  $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', ['placeholder' => 'Test alternative', 'value' => '']);
121  $I->seeElementInDOM('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', ['placeholder' => 'Test description']);
122  //textarea value is not in the attribute, so we need to check it separately
123  $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
124  }
125 
144  {
145  $I->amGoingTo('Create new CE with image with filled metadata');
146  $I->click('.t3js-page-new-ce a');
147  $I->switchToMainFrame();
148  $I->waitForElement('.t3js-modal.in');
149  $I->wait(3);
150  $I->waitForElementNotVisible('div#nprogess');
151  $I->click('Text & Images');
152  $I->switchToContentFrame();
153  $I->waitForText('Create new Page Content on page');
154  $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');
155 
156  $I->click('Images');
157  $I->click('Add image');
158  $I->switchToWindow();
159  $I->switchToIFrame('modal_frame');
160  $I->click('.list-tree-control-closed');
161  $I->click('styleguide');
162  $I->click('bus_lane.jpg');
163  $I->switchToWindow();
164  $I->switchToContentFrame();
165  $I->waitForText('bus_lane.jpg');
166 
167  $I->waitForText('Image Metadata');
168 
169  $I->seeInField('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', '');
170  $I->seeInField('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', '');
171  $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
172 
173  $I->see('(Default: "Test title")', '.t3js-form-field-eval-null-placeholder-checkbox');
174  $I->see('(Default: "Test alternative")', '.t3js-form-field-eval-null-placeholder-checkbox');
175  $I->see('(Default: "Test description")', '.t3js-form-field-eval-null-placeholder-checkbox');
176 
177  $I->amGoingTo('assert checkboxes are not checked');
178  $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[title]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
179  $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[alternative]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
180  $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[description]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
181 
182  $I->amGoingTo('Assert hidden control field value (default value which is used when checkbox is not checked');
183  $I->seeInField('//input[contains(@name, "[title]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
184  $I->seeInField('//input[contains(@name, "[alternative]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
185  $I->seeInField('//input[contains(@name, "[description]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
186 
187  //when checkbox is unchecked the disabled input is shown
188  //<input type="text" class="form-control" disabled="disabled" value="Test title">
189  $I->seeInField('input.form-control:disabled', 'Test title');
190  $I->seeInField('input.form-control:disabled', 'Test alternative');
191  $I->seeInField('textarea.form-control:disabled', 'Test description');
192  }
193 
200  private function ‪goToPageModule(‪BackendTester $I, ‪PageTree $pageTree)
201  {
202  $I->switchToMainFrame();
203  $I->click('Page');
204  $I->waitForElement('svg .nodes .node');
205  $pageTree->openPath(['styleguide TCA demo']);
206  $I->switchToContentFrame();
207  $I->waitForText('styleguide TCA demo');
208  }
209 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\FalMetadataInheritanceCest
Definition: FalMetadataInheritanceCest.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\FalMetadataInheritanceCest\checkIfFileMetadataIsInheritedInContent
‪checkIfFileMetadataIsInheritedInContent(BackendTester $I)
Definition: FalMetadataInheritanceCest.php:143
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\FalMetadataInheritanceCest\checkIfUpdatedFileMetadataIsUpdatedInContent
‪checkIfUpdatedFileMetadataIsUpdatedInContent(BackendTester $I, PageTree $pageTree)
Definition: FalMetadataInheritanceCest.php:50
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\FalMetadataInheritanceCest\_before
‪_before(BackendTester $I, PageTree $pageTree)
Definition: FalMetadataInheritanceCest.php:32
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine\FalMetadataInheritanceCest\goToPageModule
‪goToPageModule(BackendTester $I, PageTree $pageTree)
Definition: FalMetadataInheritanceCest.php:200
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine
Definition: AbstractElementsBasicCest.php:3