[TASK] Make failing acceptance tests after image update run again
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Template / TemplateCest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Template;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
18
19 /**
20 * Template tests
21 */
22 class TemplateCest
23 {
24 /**
25 * @param Admin $I
26 */
27 public function _before(Admin $I)
28 {
29 $I->useExistingSession();
30 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
31 $I->switchToIFrame('list_frame');
32 $I->waitForText('Web Content Management System');
33 $I->switchToIFrame();
34
35 $I->see('Template');
36 $I->click('Template');
37
38 // switch to content iframe
39 $I->switchToIFrame('list_frame');
40 $I->waitForElementVisible('#ts-overview');
41 $I->see('Template tools');
42 }
43
44 /**
45 * @param Admin $I
46 */
47 public function pagesWithNoTemplateShouldShowButtonsToCreateTemplates(Admin $I)
48 {
49 $I->wantTo('show templates overview on root page (uid = 0)');
50 $I->switchToIFrame();
51 // click on root page
52 $I->click('#extdd-1');
53 $I->switchToIFrame('list_frame');
54 $I->waitForElementVisible('#ts-overview');
55 $I->see('This is an overview of the pages in the database containing one or more template records. Click a page title to go to the page.');
56
57 $I->wantTo('show templates overview on website root page (uid = 1 and pid = 0)');
58 $I->switchToIFrame();
59 // click on website root page
60 $I->click('#extdd-3');
61 $I->switchToIFrame('list_frame');
62 $I->waitForText('No template');
63 $I->see('There was no template on this page!');
64 $I->see('You need to create a template record below in order to edit your configuration.');
65
66 // @todo These input fields should be changed to buttons. Should be changed to proper HTML.
67 $I->seeInFormFields(
68 '#TypoScriptTemplateModuleController',
69 [
70 'newWebsite' => 'Create template for a new site',
71 'createExtension' => 'Click here to create an extension template.',
72 ]
73 );
74 }
75
76 /**
77 * @param Admin $I
78 */
79 public function addANewSiteTemplate(Admin $I)
80 {
81 $I->wantTo('create a new site template');
82 $I->switchToIFrame();
83 $I->click('#extdd-3');
84 $I->switchToIFrame('list_frame');
85 $I->waitForText('Create new website');
86 $I->click("//input[@name='newWebsite']");
87 $I->waitForText('Edit constants for template');
88
89 $I->wantTo('change to Info/Modify and see the template overview table');
90 $I->selectOption('.t3-js-jumpMenuBox', 'Info/Modify');
91 $I->waitForElement('.table-fit');
92 $I->see('Title');
93 $I->see('Sitetitle');
94 $I->see('Description');
95 $I->see('Constants');
96 $I->see('Setup');
97 $I->see('Edit the whole template record');
98 $I->click('Edit the whole template record');
99
100 $I->wantTo('change the title and save the template');
101 $I->waitForElement('#EditDocumentController');
102 // fill title input field
103 $I->fillField('//input[@data-formengine-input-name="data[sys_template][1][title]"]', 'Acceptance Test Site');
104 $I->click("//button[@name='_savedok']");
105 $I->waitForElementNotVisible('#t3js-ui-block', 30);
106 $I->waitForElement('#EditDocumentController');
107 $I->waitForElementNotVisible('#t3js-ui-block');
108
109 $I->wantTo('change the setup, save the template and close the form');
110 // grap and fill setup textarea
111 $config = $I->grabTextFrom('//textarea[@data-formengine-input-name="data[sys_template][1][config]"]');
112 $config = str_replace('HELLO WORLD!', 'Hello Acceptance Test!', $config);
113 $I->fillField('//textarea[@data-formengine-input-name="data[sys_template][1][config]"]', $config);
114 $I->click('.btn-toolbar .btn-group.t3js-splitbutton button.btn:nth-child(2)');
115 $I->click('//a[@data-name="_saveandclosedok"]');
116
117 $I->wantTo('see the changed title');
118 $I->waitForElement('.table-fit');
119 $I->see('Acceptance Test Site');
120
121 $I->wantTo('change the template within the TypoScript Object Browser');
122 $I->selectOption('.t3-js-jumpMenuBox', 'TypoScript Object Browser');
123 $I->waitForText('Current template');
124 $I->see('CONSTANTS ROOT');
125 $I->selectOption('//select[@name="SET[ts_browser_type]"]', 'Setup');
126 $I->waitForText('SETUP ROOT');
127 // find and open [page] in tree
128 $I->see('[page] = PAGE');
129 $I->click('//span[@class="list-tree-label"]/a[text()=\'page\']/../../../a');
130 // find and open [page][10] in tree
131 $I->waitForText('[10] = TEXT');
132 $I->click('//span[@class="list-tree-label"]/a[text()=\'page\']/../../../ul//span[@class="list-tree-label"]/a[text()=\'10\']/../../../a');
133 // find and edit [page][10][value] in tree
134 $I->waitForText('[value] = Hello Acceptance Test!');
135 $I->click('//span[@class="list-tree-label"]/a[text()=\'10\']/../../../ul//span[@class="list-tree-label"]/a[text()=\'value\']');
136 $I->waitForText('page.10.value =');
137 $I->fillField('//input[@name="data[page.10.value][value]"]', 'HELLO WORLD!');
138 $I->click('//input[@name="update_value"]');
139 $I->wait(2);
140 $I->waitForText('Value updated');
141 $I->see('page.10.value = HELLO WORLD!');
142 $I->see('[value] = HELLO WORLD!');
143 }
144 }