TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
TemplateCest.php
Go to the documentation of this file.
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 
18 
23 {
28  public function _before(Admin $I)
29  {
30  $I->useExistingSession();
31  // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
32  $I->switchToIFrame('list_frame');
33  $I->waitForText('Web Content Management System');
34  $I->switchToIFrame();
35 
36  $I->see('Template');
37  $I->click('Template');
38 
39  // switch to content iframe
40  $I->switchToIFrame('list_frame');
41  $I->waitForElementVisible('#ts-overview');
42  $I->see('Template tools');
43  }
44 
50  {
51  $I->wantTo('show templates overview on root page (uid = 0)');
52  $I->switchToIFrame();
53  // click on root page
54  $I->click('#extdd-1');
55  $I->switchToIFrame('list_frame');
56  $I->waitForElementVisible('#ts-overview');
57  $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.');
58 
59  $I->wantTo('show templates overview on website root page (uid = 1 and pid = 0)');
60  $I->switchToIFrame();
61  // click on website root page
62  $I->click('#extdd-2');
63  $I->switchToIFrame('list_frame');
64  $I->waitForElementVisible('#ts-overview');
65  $I->waitForElement('#TypoScriptTemplateModuleController');
66  $I->see('No template');
67  $I->see('There was no template on this page!');
68  $I->see('You need to create a template record below in order to edit your configuration.');
69 
70  // @todo These input fields should be changed to buttons. Shoult be changed to propper HTML.
71  $I->seeInFormFields(
72  '#TypoScriptTemplateModuleController',
73  [
74  'newWebsite' => 'Create template for a new site',
75  'createExtension' => 'Click here to create an extension template.',
76  ]
77  );
78  }
79 
84  public function addANewSiteTemplate(Admin $I)
85  {
86  $I->wantTo('create a new site template');
87  $I->switchToIFrame();
88  $I->click('#extdd-2');
89  $I->switchToIFrame('list_frame');
90  $I->waitForElementVisible('#ts-overview');
91  $I->waitForElement('#TypoScriptTemplateModuleController');
92  $I->click("//input[@name='newWebsite']");
93  $I->waitForElement('#TypoScriptTemplateModuleController');
94  $I->see('Edit constants for template');
95 
96  $I->wantTo('change to Info/Modify and see the template overview table');
97  $I->selectOption('.t3-js-jumpMenuBox', 'Info/Modify');
98  $I->waitForElement('.table-fit');
99  $I->see('Title');
100  $I->see('Sitetitle');
101  $I->see('Description');
102  $I->see('Constants');
103  $I->see('Setup');
104  $I->see('Edit the whole template record');
105  $I->click('Edit the whole template record');
106 
107  $I->wantTo('change the title and save the template');
108  $I->waitForElement('#EditDocumentController');
109  // fill title input field
110  $I->fillField('//input[@data-formengine-input-name="data[sys_template][1][title]"]', 'Acceptance Test Site');
111  $I->click("//button[@name='_savedok']");
112  $I->waitForElement('#EditDocumentController');
113 
114  $I->wantTo('change the setup, save the template and close the form');
115  // grap and fill setup textarea
116  $config = $I->grabTextFrom('//textarea[@data-formengine-input-name="data[sys_template][1][config]"]');
117  $config = str_replace('HELLO WORLD!', 'Hello Acceptance Test!', $config);
118  $I->fillField('//textarea[@data-formengine-input-name="data[sys_template][1][config]"]', $config);
119  $I->click('.btn-toolbar .btn-group.t3js-splitbutton button.btn:nth-child(2)');
120  $I->click('//a[@data-name="_saveandclosedok"]');
121 
122  $I->wantTo('see the changed title');
123  $I->waitForElement('.table-fit');
124  $I->see('Acceptance Test Site');
125 
126  $I->wantTo('change the template within the TypoScript Object Browser');
127  $I->selectOption('.t3-js-jumpMenuBox', 'TypoScript Object Browser');
128  $I->waitForElement('#TypoScriptTemplateModuleController');
129  $I->see('Current template');
130  $I->see('CONSTANTS ROOT');
131  $I->selectOption('//select[@name="SET[ts_browser_type]"]', 'Setup');
132  $I->waitForElement('#TypoScriptTemplateModuleController');
133  $I->see('SETUP ROOT');
134  // find and open [page] in tree
135  $I->see('[page] = PAGE');
136  $I->click('//span[@class="list-tree-label"]/a[text()=\'page\']/../../../a');
137  $I->waitForElement('#TypoScriptTemplateModuleController');
138  // find and open [page][10] in tree
139  $I->see('[10] = TEXT');
140  $I->click('//span[@class="list-tree-label"]/a[text()=\'page\']/../../../ul//span[@class="list-tree-label"]/a[text()=\'10\']/../../../a');
141  $I->waitForElement('#TypoScriptTemplateModuleController');
142  // find and edit [page][10][value] in tree
143  $I->see('[value] = Hello Acceptance Test!');
144  $I->click('//span[@class="list-tree-label"]/a[text()=\'10\']/../../../ul//span[@class="list-tree-label"]/a[text()=\'value\']');
145  $I->waitForElement('#TypoScriptTemplateModuleController');
146  $I->see('page.10.value =');
147  $I->fillField('//input[@name="data[page.10.value][value]"]', 'HELLO WORLD!');
148  $I->click('//input[@name="update_value"]');
149  $I->waitForElement('#TypoScriptTemplateModuleController');
150  $I->see('Value updated');
151  $I->see('page.10.value = HELLO WORLD!');
152  $I->see('[value] = HELLO WORLD!');
153  }
154 }