[TASK] Enable v8 acceptance testing again
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / FormEngine / ElementsBasicInputSimpleCest.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine;
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
18 use Codeception\Example;
19 use TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester;
20 use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree;
21
22 /**
23 * Tests for "elements_basic" simple input fields of ext:styleguide
24 */
25 class ElementsBasicInputSimpleCest extends AbstractElementsBasicCest
26 {
27 /**
28 * Open list module of styleguide elements basic page
29 *
30 * @param BackendTester $I
31 * @param PageTree $pageTree
32 */
33 public function _before(BackendTester $I, PageTree $pageTree)
34 {
35 $I->useExistingSession('admin');
36 $I->click('List');
37 $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
38 $I->switchToContentFrame();
39
40 // Open record and wait until form is ready
41 $I->waitForText('elements basic', 20);
42 $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
43 $I->click($editRecordLinkCssPath);
44 $I->waitForElementNotVisible('#t3js-ui-block');
45 $I->waitForText('Edit Form', 3, 'h1');
46 }
47
48 /**
49 * Data provider to check various type=input variants
50 */
51 protected function simpleInputFieldsDataProvider()
52 {
53 return [
54 [
55 'label' => 'input_1',
56 'inputValue' => 'This is a demo text',
57 'expectedValue' => 'This is a demo text',
58 'expectedInternalValue' => 'This is a demo text',
59 'expectedValueAfterSave' => 'This is a demo text',
60 'comment' => '',
61 ],
62 [
63 'label' => 'input_2, size=10',
64 'inputValue' => 'This is a demo text with numbers and other characters 42 #!',
65 'expectedValue' => 'This is a demo text with numbers and other characters 42 #!',
66 'expectedInternalValue' => 'This is a demo text with numbers and other characters 42 #!',
67 'expectedValueAfterSave' => 'This is a demo text with numbers and other characters 42 #!',
68 'comment' => '',
69 ],
70 [
71 'label' => 'input_3 max=4',
72 'inputValue' => 'Kasper',
73 'expectedValue' => 'Kasp',
74 'expectedInternalValue' => 'Kasp',
75 'expectedValueAfterSave' => 'Kasp',
76 'comment' => '',
77 ],
78 [
79 'label' => 'input_4 eval=alpha',
80 'inputValue' => 'Kasper = TYPO3',
81 'expectedValue' => 'KasperTYPO',
82 'expectedInternalValue' => 'KasperTYPO',
83 'expectedValueAfterSave' => 'KasperTYPO',
84 'comment' => '',
85 ],
86 [
87 'label' => 'input_4 eval=alpha',
88 'inputValue' => 'Non-latin characters: ŠĐŽĆČ',
89 'expectedValue' => 'Nonlatincharacters',
90 'expectedInternalValue' => 'Nonlatincharacters',
91 'expectedValueAfterSave' => 'Nonlatincharacters',
92 'comment' => '',
93 ],
94 [
95 'label' => 'input_5 eval=alphanum',
96 'inputValue' => 'Kasper = TYPO3',
97 'expectedValue' => 'KasperTYPO3',
98 'expectedInternalValue' => 'KasperTYPO3',
99 'expectedValueAfterSave' => 'KasperTYPO3',
100 'comment' => '',
101 ],
102 [
103 'label' => 'input_10 eval=is_in, is_in=abc123',
104 'inputValue' => 'abcd1234',
105 'expectedValue' => 'abc123',
106 'expectedInternalValue' => 'abc123',
107 'expectedValueAfterSave' => 'abc123',
108 'comment' => '',
109 ],
110 [
111 'label' => 'input_10 eval=is_in, is_in=abc123',
112 'inputValue' => 'Kasper TYPO3',
113 'expectedValue' => 'a3',
114 'expectedInternalValue' => 'a3',
115 'expectedValueAfterSave' => 'a3',
116 'comment' => '',
117 ],
118 [
119 'label' => 'input_11 eval=lower',
120 'inputValue' => 'Kasper TYPO3!',
121 'expectedValue' => 'kasper typo3!',
122 'expectedInternalValue' => 'kasper typo3!',
123 'expectedValueAfterSave' => 'kasper typo3!',
124 'comment' => '',
125 ],
126 [
127 'label' => 'input_13 eval=nospace',
128 'inputValue' => ' Kasper TYPO3! ',
129 'expectedValue' => 'KasperTYPO3!',
130 'expectedInternalValue' => 'KasperTYPO3!',
131 'expectedValueAfterSave' => 'KasperTYPO3!',
132 'comment' => '',
133 ],
134 [
135 'label' => 'input_16 eval=password',
136 'inputValue' => 'Kasper',
137 'expectedValue' => '********',
138 'expectedInternalValue' => 'Kasper',
139 'expectedValueAfterSave' => 'Kasper',
140 'comment' => '',
141 ],
142 [
143 'label' => 'input_19 eval=trim',
144 'inputValue' => ' Kasper ',
145 'expectedValue' => 'Kasper',
146 'expectedInternalValue' => 'Kasper',
147 'expectedValueAfterSave' => 'Kasper',
148 'comment' => '',
149 ],
150 [
151 'label' => 'input_19 eval=trim',
152 'inputValue' => ' Kasper TYPO3 ',
153 'expectedValue' => 'Kasper TYPO3',
154 'expectedInternalValue' => 'Kasper TYPO3',
155 'expectedValueAfterSave' => 'Kasper TYPO3',
156 'comment' => '',
157 ],
158 [
159 'label' => 'input_23 eval=upper',
160 'inputValue' => 'Kasper TYPO3!',
161 'expectedValue' => 'KASPER TYPO3!',
162 'expectedInternalValue' => 'KASPER TYPO3!',
163 'expectedValueAfterSave' => 'KASPER TYPO3!',
164 'comment' => '',
165 ],
166 [
167 'label' => 'input_24 eval=year',
168 'inputValue' => '2016',
169 'expectedValue' => '2016',
170 'expectedInternalValue' => '2016',
171 'expectedValueAfterSave' => '2016',
172 'comment' => '',
173 ],
174 [
175 'label' => 'input_24 eval=year',
176 'inputValue' => '12',
177 'expectedValue' => '2012',
178 'expectedInternalValue' => '2012',
179 'expectedValueAfterSave' => '2012',
180 'comment' => '',
181 ],
182 [
183 'label' => 'input_24 eval=year',
184 'inputValue' => 'Kasper',
185 'expectedValue' => date('Y'),
186 'expectedInternalValue' => date('Y'),
187 'expectedValueAfterSave' => date('Y'),
188 'comment' => 'Invalid character is converted to current year',
189 ]
190 ];
191 }
192
193 /**
194 * @dataProvider simpleInputFieldsDataProvider
195 * @param BackendTester $I
196 * @param Example $testData
197 */
198 public function simpleInputFields(BackendTester $I, Example $testData)
199 {
200 $this->runInputFieldTest($I, $testData);
201 }
202 }