[TASK] Enable v8 acceptance testing 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\CMS\Core\Tests\Acceptance\Support\BackendTester;
18
19 /**
20 * Template tests
21 */
22 class TemplateCest
23 {
24 /**
25 * @param BackendTester $I
26 */
27 public function _before(BackendTester $I)
28 {
29 $I->useExistingSession('admin');
30
31 $I->see('Template');
32 $I->click('Template');
33
34 $I->switchToContentFrame();
35 $I->waitForElementVisible('#ts-overview');
36 $I->see('Template tools');
37 }
38
39 /**
40 * @param BackendTester $I
41 */
42 public function pagesWithNoTemplateShouldShowButtonsToCreateTemplates(BackendTester $I)
43 {
44 $I->wantTo('show templates overview on root page (uid = 0)');
45 $I->switchToMainFrame();
46 // click on root page
47 $I->click('#extdd-1');
48 $I->switchToContentFrame();
49 $I->waitForElementVisible('#ts-overview');
50 $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.');
51
52 $I->wantTo('show templates overview on website root page (uid = 1 and pid = 0)');
53 $I->switchToMainFrame();
54 // click on website root page
55 $I->click('#extdd-3');
56 $I->switchToContentFrame();
57 $I->waitForText('No template');
58 $I->see('There was no template on this page!');
59 $I->see('You need to create a template record below in order to edit your configuration.');
60
61 // @todo These input fields should be changed to buttons. Should be changed to proper HTML.
62 $I->seeInFormFields(
63 '#TypoScriptTemplateModuleController',
64 [
65 'newWebsite' => 'Create template for a new site',
66 'createExtension' => 'Click here to create an extension template.',
67 ]
68 );
69 }
70
71 /**
72 * @param BackendTester $I
73 */
74 public function addANewSiteTemplate(BackendTester $I)
75 {
76 $I->wantTo('create a new site template');
77 $I->switchToMainFrame();
78 $I->click('#extdd-3');
79 $I->switchToContentFrame('list_frame');
80 $I->waitForText('Create new website');
81 $I->click("//input[@name='newWebsite']");
82 $I->waitForText('Edit constants for template');
83
84 $I->wantTo('change to Info/Modify and see the template overview table');
85 $I->selectOption('.t3-js-jumpMenuBox', 'Info/Modify');
86 $I->waitForElement('.table-fit');
87 $I->see('Title');
88 $I->see('Sitetitle');
89 $I->see('Description');
90 $I->see('Constants');
91 $I->see('Setup');
92 $I->see('Edit the whole template record');
93 $I->click('Edit the whole template record');
94
95 $I->wantTo('change the title and save the template');
96 $I->waitForElement('#EditDocumentController');
97 // fill title input field
98 $I->fillField('//input[@data-formengine-input-name="data[sys_template][1][title]"]', 'Acceptance Test Site');
99 $I->click("//button[@name='_savedok']");
100 $I->waitForElementNotVisible('#t3js-ui-block', 30);
101 $I->waitForElement('#EditDocumentController');
102 $I->waitForElementNotVisible('#t3js-ui-block');
103
104 $I->wantTo('change the setup, save the template and close the form');
105 // grap and fill setup textarea
106 $config = $I->grabTextFrom('//textarea[@data-formengine-input-name="data[sys_template][1][config]"]');
107 $config = str_replace('HELLO WORLD!', 'Hello Acceptance Test!', $config);
108 $I->fillField('//textarea[@data-formengine-input-name="data[sys_template][1][config]"]', $config);
109
110 $I->click('.btn-toolbar .btn-group.t3js-splitbutton button.btn:nth-child(2)');
111 $I->click('//a[@data-name="_saveandclosedok"]');
112
113 $I->wantTo('see the changed title');
114 $I->waitForElement('.table-fit');
115 $I->see('Acceptance Test Site');
116
117 $I->wantTo('change the template within the TypoScript Object Browser');
118 $I->selectOption('.t3-js-jumpMenuBox', 'TypoScript Object Browser');
119 $I->waitForText('Current template');
120 $I->see('CONSTANTS ROOT');
121 $I->selectOption('//select[@name="SET[ts_browser_type]"]', 'Setup');
122 $I->waitForText('SETUP ROOT');
123 // find and open [page] in tree
124 $I->see('[page] = PAGE');
125 $I->click('//span[@class="list-tree-label"]/a[text()=\'page\']/../../../a');
126 // find and open [page][10] in tree
127 $I->waitForText('[10] = TEXT');
128 $I->click('//span[@class="list-tree-label"]/a[text()=\'page\']/../../../ul//span[@class="list-tree-label"]/a[text()=\'10\']/../../../a');
129 // find and edit [page][10][value] in tree
130 $I->waitForText('[value] = Hello Acceptance Test!');
131 $I->click('//span[@class="list-tree-label"]/a[text()=\'10\']/../../../ul//span[@class="list-tree-label"]/a[text()=\'value\']');
132 $I->waitForText('page.10.value =');
133 $I->fillField('//input[@name="data[page.10.value][value]"]', 'HELLO WORLD!');
134 $I->click('//input[@name="update_value"]');
135 $I->wait(2);
136 $I->waitForText('Value updated');
137 $I->see('page.10.value = HELLO WORLD!');
138 $I->see('[value] = HELLO WORLD!');
139 }
140 }