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