[!!!][FEATURE] Replace ExtJS page tree
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Formhandler / ElementsBasicInputCest.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler;
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\TestingFramework\Core\Acceptance\Step\Backend\Admin;
18 use TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree;
19
20 /**
21 * Tests for "elements_basic" simple input fields of ext:styleguide
22 */
23 class ElementsBasicInputCest extends AbstractElementsBasicCest
24 {
25 /**
26 * Set up selects styleguide elements basic page and opens record in FormEngine
27 *
28 * @param Admin $I
29 * @param PageTree $pageTree
30 */
31 public function _before(Admin $I, PageTree $pageTree)
32 {
33 $I->useExistingSession();
34 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
35 $I->switchToIFrame('list_frame');
36 $I->waitForText('Web Content Management System');
37 $I->switchToIFrame();
38
39 $I->click('List');
40 $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
41 $I->switchToIFrame('list_frame');
42
43 // Open record and wait until form is ready
44 $I->waitForText('elements basic');
45 $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
46 $I->click($editRecordLinkCssPath);
47 $I->waitForText('Edit Form', 3, 'h1');
48 }
49
50 /**
51 * @param Admin $I
52 */
53 public function testFieldHandlingOfSimpleFields(Admin $I)
54 {
55 $dataSets = [
56 'input_1' => [
57 [
58 'inputValue' => 'This is a demo text',
59 'expectedValue' => 'This is a demo text',
60 'expectedInternalValue' => 'This is a demo text',
61 'expectedValueAfterSave' => 'This is a demo text',
62 'comment' => '',
63 ],
64 ],
65 'input_2, size=10' => [
66 [
67 'inputValue' => 'This is a demo text with numbers and other characters 42 #!',
68 'expectedValue' => 'This is a demo text with numbers and other characters 42 #!',
69 'expectedInternalValue' => 'This is a demo text with numbers and other characters 42 #!',
70 'expectedValueAfterSave' => 'This is a demo text with numbers and other characters 42 #!',
71 'comment' => '',
72 ],
73 ],
74 'input_3 max=4' => [
75 [
76 'inputValue' => 'Kasper',
77 'expectedValue' => 'Kasp',
78 'expectedInternalValue' => 'Kasp',
79 'expectedValueAfterSave' => 'Kasp',
80 'comment' => '',
81 ],
82 ],
83 'input_4 eval=alpha' => [
84 [
85 'inputValue' => 'Kasper = TYPO3',
86 'expectedValue' => 'KasperTYPO',
87 'expectedInternalValue' => 'KasperTYPO',
88 'expectedValueAfterSave' => 'KasperTYPO',
89 'comment' => '',
90 ],
91 [
92 'inputValue' => 'Non-latin characters: ŠĐŽĆČ',
93 'expectedValue' => 'Nonlatincharacters',
94 'expectedInternalValue' => 'Nonlatincharacters',
95 'expectedValueAfterSave' => 'Nonlatincharacters',
96 'comment' => '',
97 ],
98 ],
99 'input_5 eval=alphanum' => [
100 [
101 'inputValue' => 'Kasper = TYPO3',
102 'expectedValue' => 'KasperTYPO3',
103 'expectedInternalValue' => 'KasperTYPO3',
104 'expectedValueAfterSave' => 'KasperTYPO3',
105 'comment' => '',
106 ],
107 ],
108 'input_10 eval=is_in, is_in=abc123' => [
109 [
110 'inputValue' => 'abcd1234',
111 'expectedValue' => 'abc123',
112 'expectedInternalValue' => 'abc123',
113 'expectedValueAfterSave' => 'abc123',
114 'comment' => '',
115 ],
116 [
117 'inputValue' => 'Kasper TYPO3',
118 'expectedValue' => 'a3',
119 'expectedInternalValue' => 'a3',
120 'expectedValueAfterSave' => 'a3',
121 'comment' => '',
122 ],
123 ],
124 'input_11 eval=lower' => [
125 [
126 'inputValue' => 'Kasper TYPO3!',
127 'expectedValue' => 'kasper typo3!',
128 'expectedInternalValue' => 'kasper typo3!',
129 'expectedValueAfterSave' => 'kasper typo3!',
130 'comment' => '',
131 ],
132 ],
133 'input_13 eval=nospace' => [
134 [
135 'inputValue' => ' Kasper TYPO3! ',
136 'expectedValue' => 'KasperTYPO3!',
137 'expectedInternalValue' => 'KasperTYPO3!',
138 'expectedValueAfterSave' => 'KasperTYPO3!',
139 'comment' => '',
140 ],
141 ],
142 'input_16 eval=password' => [
143 [
144 'inputValue' => 'Kasper',
145 'expectedValue' => '********',
146 'expectedInternalValue' => 'Kasper',
147 'expectedValueAfterSave' => 'Kasper',
148 'comment' => '',
149 ],
150 ],
151 'input_19 eval=trim' => [
152 [
153 'inputValue' => ' Kasper ',
154 'expectedValue' => 'Kasper',
155 'expectedInternalValue' => 'Kasper',
156 'expectedValueAfterSave' => 'Kasper',
157 'comment' => '',
158 ],
159 [
160 'inputValue' => ' Kasper TYPO3 ',
161 'expectedValue' => 'Kasper TYPO3',
162 'expectedInternalValue' => 'Kasper TYPO3',
163 'expectedValueAfterSave' => 'Kasper TYPO3',
164 'comment' => '',
165 ],
166 ],
167 'input_23 eval=upper' => [
168 [
169 'inputValue' => 'Kasper TYPO3!',
170 'expectedValue' => 'KASPER TYPO3!',
171 'expectedInternalValue' => 'KASPER TYPO3!',
172 'expectedValueAfterSave' => 'KASPER TYPO3!',
173 'comment' => '',
174 ],
175 ],
176 'input_24 eval=year' => [
177 [
178 'inputValue' => '2016',
179 'expectedValue' => '2016',
180 'expectedInternalValue' => '2016',
181 'expectedValueAfterSave' => '2016',
182 'comment' => '',
183 ],
184 [
185 'inputValue' => '12',
186 'expectedValue' => '12',
187 'expectedInternalValue' => '12',
188 'expectedValueAfterSave' => '12',
189 'comment' => '',
190 ],
191 [
192 'inputValue' => 'Kasper',
193 'expectedValue' => date('Y'),
194 'expectedInternalValue' => date('Y'),
195 'expectedValueAfterSave' => date('Y'),
196 'comment' => 'Invalid character is converted to current year',
197 ],
198 ]
199 ];
200 $this->runTests($I, $dataSets);
201 }
202
203 /**
204 * @param Admin $I
205 */
206 public function testHandlingOfEvalFields(Admin $I)
207 {
208 $dataSets = [
209 'input_8 eval=double2' => [
210 [
211 'inputValue' => '12.335',
212 'expectedValue' => '12.34',
213 'expectedInternalValue' => '12.34',
214 'expectedValueAfterSave' => '12.34',
215 'comment' => '',
216 ],
217 [
218 'inputValue' => '12,335', // comma as delimiter
219 'expectedValue' => '12.34',
220 'expectedInternalValue' => '12.34',
221 'expectedValueAfterSave' => '12.34',
222 'comment' => '',
223 ],
224 [
225 'inputValue' => '1.1', // comma as delimiter
226 'expectedValue' => '1.10',
227 'expectedInternalValue' => '1.10',
228 'expectedValueAfterSave' => '1.10',
229 'comment' => '',
230 ],
231 [
232 'inputValue' => 'TYPO3', // comma as delimiter
233 'expectedValue' => '3.00',
234 'expectedInternalValue' => '3.00',
235 'expectedValueAfterSave' => '3.00',
236 'comment' => '',
237 ],
238 [
239 'inputValue' => '3TYPO', // comma as delimiter
240 'expectedValue' => '3.00',
241 'expectedInternalValue' => '3.00',
242 'expectedValueAfterSave' => '3.00',
243 'comment' => '',
244 ],
245 ],
246 'input_9 eval=int' => [
247 [
248 'inputValue' => '12.335',
249 'expectedValue' => '12',
250 'expectedInternalValue' => '12',
251 'expectedValueAfterSave' => '12',
252 'comment' => '',
253 ],
254 [
255 'inputValue' => '12,9',
256 'expectedValue' => '12',
257 'expectedInternalValue' => '12',
258 'expectedValueAfterSave' => '12',
259 'comment' => '',
260 ],
261 [
262 'inputValue' => 'TYPO3',
263 'expectedValue' => '0',
264 'expectedInternalValue' => '0',
265 'expectedValueAfterSave' => '0',
266 'comment' => '',
267 ],
268 [
269 'inputValue' => '3TYPO',
270 'expectedValue' => '3',
271 'expectedInternalValue' => '3',
272 'expectedValueAfterSave' => '3',
273 'comment' => '',
274 ],
275 ],
276 'input_15 eval=num' => [
277 [
278 'inputValue' => '12.335',
279 'expectedValue' => '12335',
280 'expectedInternalValue' => '12335',
281 'expectedValueAfterSave' => '12335',
282 'comment' => '',
283 ],
284 [
285 'inputValue' => '12,9',
286 'expectedValue' => '129',
287 'expectedInternalValue' => '129',
288 'expectedValueAfterSave' => '129',
289 'comment' => '',
290 ],
291 [
292 'inputValue' => 'TYPO3',
293 'expectedValue' => '3',
294 'expectedInternalValue' => '3',
295 'expectedValueAfterSave' => '3',
296 'comment' => '',
297 ],
298 [
299 'inputValue' => '3TYPO',
300 'expectedValue' => '3',
301 'expectedInternalValue' => '3',
302 'expectedValueAfterSave' => '3',
303 'comment' => '',
304 ],
305 ],
306 ];
307 $this->runTests($I, $dataSets);
308 }
309
310 /**
311 * @param Admin $I
312 */
313 public function testHandlingOfRangeAndMd5Fields(Admin $I)
314 {
315 $dataSets = [
316 'input_25 eval=int, default=0, range lower=-2, range upper=2' => [
317 [
318 'inputValue' => 'Kasper TYPO3',
319 'expectedValue' => '0',
320 'expectedInternalValue' => '0',
321 'expectedValueAfterSave' => '0',
322 'comment' => '',
323 ],
324 [
325 'inputValue' => '2',
326 'expectedValue' => '2',
327 'expectedInternalValue' => '2',
328 'expectedValueAfterSave' => '2',
329 'comment' => '',
330 ],
331 [
332 'inputValue' => '-1',
333 'expectedValue' => '-1',
334 'expectedInternalValue' => '-1',
335 'expectedValueAfterSave' => '-1',
336 'comment' => '',
337 ],
338 ],
339 'input_12 eval=md5' => [
340 [
341 'inputValue' => 'Kasper TYPO3!',
342 'expectedValue' => '748469dd64911af8df8f9a3dcb2c9378',
343 'expectedInternalValue' => '748469dd64911af8df8f9a3dcb2c9378',
344 'expectedValueAfterSave' => '748469dd64911af8df8f9a3dcb2c9378',
345 'comment' => '',
346 ],
347 [
348 'inputValue' => ' Kasper TYPO3! ',
349 'expectedValue' => '792a085606250c47d6ebb8c98804d5b0',
350 'expectedInternalValue' => '792a085606250c47d6ebb8c98804d5b0',
351 'expectedValueAfterSave' => '792a085606250c47d6ebb8c98804d5b0',
352 'comment' => 'Check whitespaces are not trimmed.',
353 ],
354 ],
355 ];
356 $this->runTests($I, $dataSets);
357 }
358 }