[TASK] Switch to chrome in ac tests
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Acceptance / Backend / Formhandler / ElementsBasicInputDateCest.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" date and time related input fields of ext:styleguide
22 */
23 class ElementsBasicInputDateCest 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 $I->click('inputDateTime');
49 $I->waitForText('inputDateTime', 3);
50 }
51
52 /**
53 * @param Admin $I
54 */
55 public function checkThatValidationWorks_EvalDate_TypeDate(Admin $I)
56 {
57 $dataSets = [
58 'inputdatetime_2 dbType=date eval=date' => [
59 [
60 'inputValue' => '29-01-2016',
61 'expectedValue' => '29-01-2016',
62 'expectedInternalValue' => '2016-01-29T00:00:00Z',
63 'expectedValueAfterSave' => '2016-01-29T00:00:00+00:00',
64 'comment' => '',
65 ],
66 [
67 'inputValue' => '13-13-2016',
68 'expectedValue' => '13-01-2017',
69 'expectedInternalValue' => '2017-01-13T00:00:00Z',
70 'expectedValueAfterSave' => '2017-01-13T00:00:00+00:00',
71 'comment' => '',
72 ],
73 [
74 'inputValue' => '29-02-2016',
75 'expectedValue' => '29-02-2016',
76 'expectedInternalValue' => '2016-02-29T00:00:00Z',
77 'expectedValueAfterSave' => '2016-02-29T00:00:00+00:00',
78 'comment' => 'Check valid leap year input',
79 ],
80 [
81 'inputValue' => '29-02-2015',
82 'expectedValue' => '01-03-2015',
83 'expectedInternalValue' => '2015-03-01T00:00:00Z',
84 'expectedValueAfterSave' => '2015-03-01T00:00:00+00:00',
85 'comment' => 'Check invalid leap year transformation',
86 ],
87 ]
88 ];
89 $this->runTests($I, $dataSets);
90 }
91
92 /**
93 * @param Admin $I
94 */
95 public function checkThatValidationWorks_EvalDateTime(Admin $I)
96 {
97 $dataSets = [
98 'inputdatetime_3 eval=datetime' => [
99 [
100 'inputValue' => '05:23 29-01-2016',
101 'expectedValue' => '05:23 29-01-2016',
102 'expectedInternalValue' => '2016-01-29T05:23:00Z',
103 'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
104 'comment' => '',
105 ],
106 [
107 'inputValue' => '05:23 13-13-2016',
108 'expectedValue' => '05:23 13-01-2017',
109 'expectedInternalValue' => '2017-01-13T05:23:00Z',
110 'expectedValueAfterSave' => '2017-01-13T05:23:00+00:00',
111 'comment' => '',
112 ],
113 [
114 'inputValue' => '05:23 29-02-2016',
115 'expectedValue' => '05:23 29-02-2016',
116 'expectedInternalValue' => '2016-02-29T05:23:00Z',
117 'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
118 'comment' => 'Check valid leap year input',
119 ],
120 [
121 'inputValue' => '05:23 29-02-2015',
122 'expectedValue' => '05:23 01-03-2015',
123 'expectedInternalValue' => '2015-03-01T05:23:00Z',
124 'expectedValueAfterSave' => '2015-03-01T05:23:00+00:00',
125 'comment' => 'Check invalid leap year transformation',
126 ],
127 ]
128 ];
129 $this->runTests($I, $dataSets);
130 }
131
132 /**
133 * @param Admin $I
134 */
135 public function checkThatValidationWorks_evalTime(Admin $I)
136 {
137 $dataSets = [
138 'inputdatetime_5' => [
139 [
140 'inputValue' => '13:30',
141 'expectedValue' => '13:30',
142 'expectedInternalValue' => '13:30',
143 'expectedValueAfterSave' => (new \DateTime('13:30'))->getTimestamp(),
144 'comment' => '',
145 ],
146 [
147 'inputValue' => '123',
148 'expectedValue' => '12:03',
149 'expectedInternalValue' => '12:03',
150 'expectedValueAfterSave' => (new \DateTime('12:03'))->getTimestamp(),
151 'comment' => '',
152 ],
153 [
154 'inputValue' => '12345',
155 'expectedValue' => '12:34',
156 'expectedInternalValue' => '12:34',
157 'expectedValueAfterSave' => (new \DateTime('12:34'))->getTimestamp(),
158 'comment' => '',
159 ],
160 [
161 'inputValue' => '12:04+5',
162 'expectedValue' => '12:09',
163 'expectedInternalValue' => '12:09',
164 'expectedValueAfterSave' => (new \DateTime('12:09'))->getTimestamp(),
165 'comment' => '',
166 ],
167 [
168 'inputValue' => '12:09-3',
169 'expectedValue' => '12:06',
170 'expectedInternalValue' => '12:06',
171 'expectedValueAfterSave' => (new \DateTime('12:06'))->getTimestamp(),
172 'comment' => '',
173 ],
174 ],
175 ];
176 $this->runTests($I, $dataSets);
177 }
178
179 /**
180 * @param Admin $I
181 */
182 /*
183 public function checkThatValidationWorks_EvalDateTime_DbTypeDateTime(Admin $I)
184 {
185 // @todo fix these unstable test
186 $dataSets = [
187 'input_37 dbType=datetime eval=datetime' => [
188 [
189 'inputValue' => '05:23 29-01-2016',
190 'expectedValue' => '05:23 29-01-2016',
191 'expectedInternalValue' => '2016-01-29T05:23:00Z',
192 'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
193 'comment' => '',
194 ],
195 [
196 'inputValue' => '05:23 13-13-2016',
197 'expectedValue' => '05:23 13-01-2017',
198 'expectedInternalValue' => '2017-01-13T05:23:00Z',
199 'expectedValueAfterSave' => '2017-01-13T05:23:00+00:00',
200 'comment' => '',
201 ],
202 [
203 'inputValue' => '05:23 29-02-2016',
204 'expectedValue' => '05:23 29-02-2016',
205 'expectedInternalValue' => '2016-02-29T05:23:00Z',
206 'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
207 'comment' => 'Check valid leap year input',
208 ],
209 [
210 'inputValue' => '05:23 29-02-2015',
211 'expectedValue' => '05:23 01-03-2015',
212 'expectedInternalValue' => '2015-03-01T05:23:00Z',
213 'expectedValueAfterSave' => '2015-03-01T05:23:00+00:00',
214 'comment' => 'Check invalid leap year transformation',
215 ],
216 ],
217 'input_18 eval=timesec' => [
218 [
219 'inputValue' => '13:30:00',
220 'expectedValue' => '13:30:00',
221 'expectedInternalValue' => '13:30:00',
222 'expectedValueAfterSave' => (new \DateTime('13:30:00'))->getTimestamp(),
223 'comment' => '',
224 ],
225 [
226 'inputValue' => '12345',
227 'expectedValue' => '12:34:05',
228 'expectedInternalValue' => '12:34:05',
229 'expectedValueAfterSave' => (new \DateTime('12:34:05'))->getTimestamp(),
230 'comment' => '',
231 ],
232 [
233 'inputValue' => '12:04:04+5',
234 'expectedValue' => '12:09:04',
235 'expectedInternalValue' => '12:09:04',
236 'expectedValueAfterSave' => (new \DateTime('12:09:04'))->getTimestamp(),
237 'comment' => '',
238 ],
239 ],
240 'input_6 eval=date' => [
241 [
242 'inputValue' => '29-01-2016',
243 'expectedValue' => '29-01-2016',
244 'expectedInternalValue' => '2016-01-29T00:00:00Z',
245 'expectedValueAfterSave' => '2016-01-29T00:00:00+00:00',
246 'comment' => '',
247 ],
248 [
249 'inputValue' => '13-13-2016',
250 'expectedValue' => '13-01-2017',
251 'expectedInternalValue' => '2017-01-13T00:00:00Z',
252 'expectedValueAfterSave' => '2017-01-13T00:00:00+00:00',
253 'comment' => '',
254 ],
255 [
256 'inputValue' => '29-02-2016',
257 'expectedValue' => '29-02-2016',
258 'expectedInternalValue' => '2016-02-29T00:00:00Z',
259 'expectedValueAfterSave' => '2016-02-29T00:00:00+00:00',
260 'comment' => 'Check valid leap year input',
261 ],
262 [
263 'inputValue' => '29-02-2015',
264 'expectedValue' => '01-03-2015',
265 'expectedInternalValue' => '2015-03-01T00:00:00Z',
266 'expectedValueAfterSave' => '2015-03-01T00:00:00+00:00',
267 'comment' => 'Check invalid leap year transformation',
268 ],
269 ],
270 ];
271 $this->runTests($I, $dataSets);
272 }
273 */
274 }