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