TYPO3 CMS  TYPO3_8-7
FalMetadataInheritanceCest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
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.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
22 
27 {
28  public function _before(BackendTester $I, PageTree $pageTree)
29  {
30  $I->useExistingSession('admin');
31  $this->goToPageModule($I, $pageTree);
32  }
33 
47  {
48  $I->amGoingTo('Create new CE with image');
49  $I->click('.t3js-page-new-ce a');
50  $I->waitForElementNotVisible('div#nprogess');
51  $I->click('Text & Images');
52  $I->waitForText('Create new Page Content on page');
53  $I->fillField('//input[contains(@data-formengine-input-name, "data[tt_content]") and contains(@data-formengine-input-name, "[header]")]', 'tt_content with image');
54 
55  $I->click('Images');
56  $I->click('Add image');
57 
58  $I->switchToWindow('Typo3WinBrowser');
59  try {
60  $I->click('.list-tree-control-closed');
61  $I->click('styleguide');
62  $I->click('bus_lane.jpg');
63  } catch (NoSuchWindowException $e) {
64  // missing focus by auto close window
65  }
66 
67  $I->switchToWindow();
68  $I->switchToContentFrame();
69  $I->waitForText('bus_lane.jpg');
70 
71  $I->see('Set element specific value (No default)', '.t3js-form-field-eval-null-placeholder-checkbox');
72 
73  $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', ['placeholder' => '', 'value' => '']);
74  $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', ['placeholder' => '', 'value' => '']);
75  $I->seeElementInDOM('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', ['placeholder' => '']);
76  //textarea value is not in the attribute, so we need to check it separately
77  $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
78 
79  $I->click('button[name="_savedok"]');
80  $I->wait(3);
81  $I->click('a[title="Close"]');
82 
83  $I->amGoingTo('Change default metadata');
84  $I->switchToMainFrame();
85  $I->click('Filelist');
86  $I->switchToIFrame('typo3-navigationContainerIframe');
87  $I->waitForText('fileadmin/ (auto-created)');
88  $I->click('styleguide');
89 
90  $I->switchToWindow();
91  $I->switchToContentFrame();
92  $I->click('bus_lane.jpg');
93  $I->waitForText('Edit File Metadata "bus_lane.jpg" on root level');
94  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[title]")]', 'Test title');
95  $I->fillField('//textarea[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[description]")]', 'Test description');
96  $I->fillField('//input[contains(@data-formengine-input-name, "data[sys_file_metadata]") and contains(@data-formengine-input-name, "[alternative]")]', 'Test alternative');
97 
98  $I->click('button[name="_savedok"]');
99  $I->wait(3);
100  $I->click('a[title="Close"]');
101 
102  $I->amGoingTo('Check metadata of sys_file_reference displayed in tt_content');
103  $this->goToPageModule($I, $pageTree);
104  $I->switchToWindow();
105  $I->switchToContentFrame();
106  $I->click('tt_content with image');
107  $I->waitForElementNotVisible('#t3js-ui-block');
108  $I->waitForText('Edit Page Content "tt_content with image" on page "styleguide TCA demo"');
109  $I->click('Images');
110  $I->click('.form-irre-header');
111 
112  $I->see('(Default: "Test title")', '.t3js-form-field-eval-null-placeholder-checkbox');
113  $I->see('(Default: "Test alternative")', '.t3js-form-field-eval-null-placeholder-checkbox');
114  $I->see('(Default: "Test description")', '.t3js-form-field-eval-null-placeholder-checkbox');
115 
116  $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', ['placeholder' => 'Test title', 'value' => '']);
117  $I->seeElementInDOM('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', ['placeholder' => 'Test alternative', 'value' => '']);
118  $I->seeElementInDOM('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', ['placeholder' => 'Test description']);
119  //textarea value is not in the attribute, so we need to check it separately
120  $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
121  }
122 
141  {
142  $I->amGoingTo('Create new CE with image with filled metadata');
143  $I->click('.t3js-page-new-ce a');
144  $I->waitForElementNotVisible('div#nprogess');
145  $I->click('Text & Images');
146  $I->waitForText('Create new Page Content on page');
147  $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');
148 
149  $I->click('Images');
150  $I->click('Add image');
151 
152  $I->switchToWindow('Typo3WinBrowser');
153  try {
154  $I->click('.list-tree-control-closed');
155  $I->click('styleguide');
156  $I->click('bus_lane.jpg');
157  } catch (NoSuchWindowException $e) {
158  // missing focus by auto close window
159  }
160 
161  $I->switchToWindow();
162  $I->switchToContentFrame();
163  $I->waitForText('bus_lane.jpg');
164 
165  $I->waitForText('Image Metadata');
166 
167  $I->seeInField('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[title]")]', '');
168  $I->seeInField('//input[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[alternative]")]', '');
169  $I->seeInField('//textarea[contains(@data-formengine-input-name, "data[sys_file_reference]") and contains(@data-formengine-input-name, "[description]")]', '');
170 
171  $I->see('(Default: "Test title")', '.t3js-form-field-eval-null-placeholder-checkbox');
172  $I->see('(Default: "Test alternative")', '.t3js-form-field-eval-null-placeholder-checkbox');
173  $I->see('(Default: "Test description")', '.t3js-form-field-eval-null-placeholder-checkbox');
174 
175  $I->amGoingTo('assert checkboxes are not checked');
176  $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[title]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
177  $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[alternative]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
178  $I->dontSeeCheckboxIsChecked('//input[contains(@name, "[description]") and @type="checkbox" and contains(@name, "control[active][sys_file_reference]")]');
179 
180  $I->amGoingTo('Assert hidden control field value (default value which is used when checkbox is not checked');
181  $I->seeInField('//input[contains(@name, "[title]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
182  $I->seeInField('//input[contains(@name, "[alternative]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
183  $I->seeInField('//input[contains(@name, "[description]") and @type="hidden" and contains(@name, "control[active][sys_file_reference]")]', 0);
184 
185  //when checkbox is unchecked the disabled input is shown
186  //<input type="text" class="form-control" disabled="disabled" value="Test title">
187  $I->seeInField('input.form-control:disabled', 'Test title');
188  $I->seeInField('input.form-control:disabled', 'Test alternative');
189  $I->seeInField('textarea.form-control:disabled', 'Test description');
190  }
191 
197  protected function goToPageModule(BackendTester $I, PageTree $pageTree)
198  {
199  $I->switchToMainFrame();
200  $I->click('Page');
201  $pageTree->openPath(['styleguide TCA demo']);
202  $I->switchToContentFrame();
203  $I->waitForText('styleguide TCA demo');
204  }
205 }