‪TYPO3CMS  10.4
TemplateCest.php
Go to the documentation of this file.
1 <?php
2 
3 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 
21 
26 {
30  public function ‪_before(‪BackendTester $I)
31  {
32  $I->useExistingSession('admin');
33 
34  $I->see('Template');
35  $I->click('Template');
36 
37  $I->switchToContentFrame();
38  $I->waitForElementVisible('#ts-overview');
39  $I->see('Template tools');
40  }
41 
46  {
47  $I->wantTo('show templates overview on root page (uid = 0)');
48  $I->waitForElementVisible('#ts-overview');
49  $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.');
50 
51  $I->wantTo('show templates overview on website root page (uid = 1 and pid = 0)');
52  $I->switchToMainFrame();
53  // click on website root page
54  $I->clickWithLeftButton('//*[text()=\'styleguide TCA demo\']');
55  $I->switchToContentFrame();
56  $I->waitForText('No template');
57  $I->see('There was no template on this page!');
58  $I->see('You need to create a template record below in order to edit your configuration.');
59 
60  // @todo These input fields should be changed to buttons. Should be changed to proper HTML.
61  $I->seeInFormFields(
62  '#TypoScriptTemplateModuleController',
63  [
64  'newWebsite' => 'Create template for a new site',
65  'createExtension' => 'Click here to create an extension template.',
66  ]
67  );
68  }
69 
74  {
75  $I->wantTo('create a new site template');
76  $I->switchToMainFrame();
77  $I->clickWithLeftButton('//*[text()=\'styleguide TCA demo\']');
78  $I->switchToContentFrame();
79  $I->waitForText('Create new website');
80  $I->click("//input[@name='newWebsite']");
81  $I->waitForText('Edit constants for template');
82 
83  $I->wantTo('change to Info/Modify and see the template overview table');
84  $I->selectOption('.t3-js-jumpMenuBox', 'Info/Modify');
85  $I->waitForElement('.table-fit');
86  $I->see('Title');
87  $I->see('Sitetitle');
88  $I->see('Description');
89  $I->see('Constants');
90  $I->see('Setup');
91  $I->see('Edit the whole template record');
92  $I->click('Edit the whole template record');
93 
94  $I->wantTo('change the title and save the template');
95  $I->waitForElement('#EditDocumentController');
96  // fill title input field
97  $I->fillField('//input[@data-formengine-input-name="data[sys_template][1][title]"]', 'Acceptance Test Site');
98  $I->click("//button[@name='_savedok']");
99  $I->waitForElementNotVisible('#t3js-ui-block', 30);
100  $I->waitForElement('#EditDocumentController');
101  $I->waitForElementNotVisible('#t3js-ui-block');
102 
103  $I->wantTo('change the setup, save the template and close the form');
104  // grab and fill setup textarea
105  $config = $I->grabTextFrom('//textarea[@data-formengine-input-name="data[sys_template][1][config]"]');
106  $config = str_replace('HELLO WORLD!', 'Hello Acceptance Test!', $config);
107  $I->fillField('//textarea[@data-formengine-input-name="data[sys_template][1][config]"]', $config);
108 
109  $I->click('//*/button[@name="_savedok"][1]');
110  $I->waitForElement('a.t3js-editform-close');
111  $I->click('a.t3js-editform-close');
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 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Template\TemplateCest\pagesWithNoTemplateShouldShowButtonsToCreateTemplates
‪pagesWithNoTemplateShouldShowButtonsToCreateTemplates(BackendTester $I)
Definition: TemplateCest.php:45
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Template\TemplateCest\addANewSiteTemplate
‪addANewSiteTemplate(BackendTester $I)
Definition: TemplateCest.php:73
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Template\TemplateCest
Definition: TemplateCest.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Template\TemplateCest\_before
‪_before(BackendTester $I)
Definition: TemplateCest.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Template
Definition: TemplateCest.php:18