[TASK] AC tests: Restructure styleguide field tests 43/51743/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 18 Feb 2017 17:28:49 +0000 (18:28 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 18 Feb 2017 18:40:21 +0000 (19:40 +0100)
Simplify styleguide "elements basic" acceptance tests to
be easier understandable, split them into two Cest files.

Change-Id: I37ba7a043134e7b2d2291d517c6d0e6aa4c239ae
Resolves: #79893
Releases: master
Reviewed-on: https://review.typo3.org/51743
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
components/testing_framework/Classes/Core/Acceptance/Support/Helper/FormHandlerElementTestDataObject.php [deleted file]
components/testing_framework/Classes/Core/Acceptance/Support/Helper/Formhandler.php [deleted file]
components/testing_framework/Migrations/Code/ClassAliasMap.php
typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/AbstractElementsBasicCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicCest.php [deleted file]
typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicInputCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicInputDateCest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/Inline1nCest.php

diff --git a/components/testing_framework/Classes/Core/Acceptance/Support/Helper/FormHandlerElementTestDataObject.php b/components/testing_framework/Classes/Core/Acceptance/Support/Helper/FormHandlerElementTestDataObject.php
deleted file mode 100644 (file)
index bfc45fe..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-declare(strict_types=1);
-namespace TYPO3\TestingFramework\Core\Acceptance\Support\Helper;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * Class FormHandlerElementTestDataObject.
- */
-class FormHandlerElementTestDataObject
-{
-    /**
-     * The test value.
-     *
-     * @var string
-     */
-    public $inputValue;
-
-    /**
-     * The expected value as seen by the user.
-     *
-     * @var string
-     */
-    public $expectedValue;
-
-    /**
-     * The expected value in the value attribute of the hidden field
-     * (full ISO date for example).
-     *
-     * @var string
-     */
-    public $expectedInternalValue;
-
-    /**
-     * Expected value in hidden field after saving the data.
-     *
-     * @var string
-     */
-    public $expectedValueAfterSave;
-
-    /**
-     * Does this test data set result in a modal window (e.g. for errors)?
-     *
-     * @var bool
-     */
-    public $notificationExpected;
-
-    /**
-     * Comment echoed in test log.
-     *
-     * @var string
-     */
-    public $comment;
-
-    /**
-     * FormHandlerElementTestDataObject constructor.
-     *
-     * @param string $inputValue
-     * @param string $expectedValue
-     * @param string $expectedInternalValue
-     * @param string $expectedValueAfterSave
-     * @param bool   $notificationExpected
-     * @param string $comment
-     */
-    public function __construct(
-        string $inputValue,
-        string $expectedValue,
-        string $expectedInternalValue = '',
-        string $expectedValueAfterSave = '',
-        bool $notificationExpected = false,
-        string $comment = ''
-    ) {
-        $this->inputValue = $inputValue;
-        $this->expectedValue = $expectedValue;
-        $this->expectedInternalValue = $expectedInternalValue;
-        $this->expectedValueAfterSave = $expectedValueAfterSave;
-        $this->notificationExpected = $notificationExpected;
-        $this->comment = $comment;
-    }
-}
diff --git a/components/testing_framework/Classes/Core/Acceptance/Support/Helper/Formhandler.php b/components/testing_framework/Classes/Core/Acceptance/Support/Helper/Formhandler.php
deleted file mode 100644 (file)
index ab125f1..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-<?php
-namespace TYPO3\TestingFramework\Core\Acceptance\Support\Helper;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use Facebook\WebDriver\Remote\RemoteWebElement;
-use Facebook\WebDriver\WebDriverKeys;
-
-/**
- * Helper to interact with formhandler fields
- */
-class Formhandler
-{
-    /**
-     * Selector to select one formengine section
-     *
-     * @var string
-     */
-    public static $selectorFormSection = '.form-section';
-    protected $visibleFieldPath = './/*/input[@data-formengine-input-name]';
-    protected $initializedInputFieldXpath;
-    protected $internalInputFieldXpath;
-    protected $internalInputFieldXpath1;
-    protected $internalFieldXpath;
-    /**
-     * @var \AcceptanceTester
-     */
-    protected $tester;
-
-    /**
-     * @param \AcceptanceTester $I
-     */
-    public function __construct(\AcceptanceTester $I)
-    {
-        $this->tester = $I;
-    }
-
-    /**
-     * @param string $fieldLabel
-     * @param FormHandlerElementTestDataObject[] $testData An array of Objects that contains the data to validate.
-     */
-    public function fillSeeSaveAndClearInputField($fieldLabel, array $testData)
-    {
-        $I = $this->tester;
-        $I->wantTo('Fill field, check the fieldvalue after evaluation and delete the value.');
-
-        $this->initializeFieldSelectors($fieldLabel);
-
-        foreach ($testData as $data) {
-            list($inputField, $internalInputField) = $this->getInputFields($fieldLabel);
-            $fieldContext = $this->getContextForFormhandlerField($fieldLabel);
-
-            $expectedInternal = $data->expectedInternalValue !== '' ? $data->expectedInternalValue : $data->expectedValue;
-            $expectedInternalAfterSave = $data->expectedValueAfterSave !== '' ? $data->expectedValueAfterSave : $expectedInternal;
-            $this->addComment($data->comment);
-
-            $I->comment('Fill the field and switch focus to trigger validation.');
-            $I->fillField($inputField, $data->inputValue);
-            // change the focus to trigger validation
-            $inputField->sendKeys(WebDriverKeys::TAB);
-            // click on the div so that any opened popup (potentially from the field below) is closed
-            $fieldContext->click();
-
-            $this->testFieldValues($inputField, $data->expectedValue, $internalInputField, $expectedInternal);
-
-            if ($data->notificationExpected) {
-                $this->save();
-                $this->closeNotification();
-                return;
-            } else {
-                $this->save();
-            }
-
-            // wait for the save to be completed
-            $this->waitForSaveToBeCompleted();
-
-            // find the fields again (after reload of iframe)
-            list($inputField, $internalInputField) = $this->getInputFields($fieldLabel);
-
-            // validate that the save was successful
-            $this->testFieldValues($inputField, $data->expectedValue, $internalInputField, $expectedInternalAfterSave);
-        }
-
-        list($inputField) = $this->getInputFields($fieldLabel);
-
-        // clear the field
-        $this->clearField($inputField);
-        $this->save();
-        $this->waitForSaveToBeCompleted();
-    }
-
-    /**
-     * @param $comment
-     */
-    protected function addComment($comment)
-    {
-        if ($comment !== null) {
-            $this->tester->comment($comment);
-        }
-    }
-
-    protected function clearField($inputField)
-    {
-        $I = $this->tester;
-        $I->comment('Clear the field');
-        $I->waitForElementVisible($this->initializedInputFieldXpath);
-        $I->fillField($inputField, '');
-    }
-
-    protected function closeNotification()
-    {
-        $I = $this->tester;
-        $I->switchToWindow();
-        $notificationCloseXpath = '//*[@class="modal-title"][contains(text(),"Alert")]/parent::*/button[@class="close"]';
-        $I->waitForElement($notificationCloseXpath, 30);
-        $I->click($notificationCloseXpath);
-    }
-
-    /**
-     * @param string $fieldName
-     * @return RemoteWebElement
-     */
-    protected function getContextForFormhandlerField(string $fieldName)
-    {
-        $I = $this->tester;
-        $I->comment('Get context for field "' . $fieldName . '"');
-
-        return $I->executeInSelenium(
-            function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use ($fieldName) {
-                return $webdriver->findElement(
-                    \WebDriverBy::xpath(
-                        '(//label[contains(text(),"' .
-                        $fieldName .
-                        '")])[1]/ancestor::fieldset[@class="form-section"][1]'
-                    )
-                );
-            }
-        );
-    }
-
-    /**
-     * @param $fieldLabel
-     * @return array
-     */
-    protected function getInputFields($fieldLabel)
-    {
-        $I = $this->tester;
-        $I->comment('get input fields');
-        $I->waitForElement($this->initializedInputFieldXpath, 30);
-        $fieldContext = $this->getContextForFormhandlerField($fieldLabel);
-        $inputField = $fieldContext->findElement(\WebDriverBy::xpath($this->visibleFieldPath));
-        $internalInputFieldXpath = '(//label[contains(text(),"' .
-                                   $fieldLabel .
-                                   '")])[1]/parent::*//*/input[@name="' .
-                                   $inputField->getAttribute('data-formengine-input-name') .
-                                   '"]';
-
-        $I->waitForElement($internalInputFieldXpath, 30);
-
-        $this->internalFieldXpath = './/*/input[@name="' .
-                                    $inputField->getAttribute('data-formengine-input-name') .
-                                    '"]';
-        $internalInputField = $fieldContext->findElement(\WebDriverBy::xpath($this->internalFieldXpath));
-
-        $this->internalInputFieldXpath = $internalInputFieldXpath;
-        return [$inputField, $internalInputField];
-    }
-
-    /**
-     * @param $fieldLabel
-     * @return array
-     */
-    protected function initializeFieldSelectors($fieldLabel)
-    {
-        $this->initializedInputFieldXpath = '(//label[contains(text(),"' .
-                                            $fieldLabel .
-                                            '")])[1]/parent::*//*/input[@data-formengine-input-name]' .
-                                            '[@data-formengine-input-initialized]';
-    }
-
-    /**
-     */
-    protected function save()
-    {
-        $I = $this->tester;
-        $I->comment('Save the form');
-        $saveButtonLink = '//*/button[@name="_savedok"][1]';
-        $I->waitForElement($saveButtonLink, 30);
-        $I->click($saveButtonLink);
-    }
-
-    /**
-     * @param $inputField
-     * @param $expectedAfterValidation
-     * @param $internalInputField
-     * @param $expectedInternal
-     */
-    protected function testFieldValues(
-        $inputField,
-        $expectedAfterValidation,
-        $internalInputField,
-        $expectedInternal
-    ) {
-        $I = $this->tester;
-        $I->comment('Test value of "visible" field');
-        $I->canSeeInField($inputField, $expectedAfterValidation);
-        $I->comment('Test value of the internal field');
-        $I->canSeeInField($internalInputField, $expectedInternal);
-    }
-
-    /**
-     */
-    protected function waitForSaveToBeCompleted()
-    {
-        $I = $this->tester;
-        $I->comment('wait for save to be completed');
-        $I->waitForElement('//*/button[@name="_savedok"][not(@disabled)][1]', 30);
-        $I->waitForElement($this->initializedInputFieldXpath, 30);
-        $I->waitForElement($this->internalInputFieldXpath, 30);
-    }
-}
index c52c86c..99c3a45 100644 (file)
@@ -4,8 +4,6 @@ return [
     // Acceptance
     '\\TYPO3\\Components\\TestingFramework\\Core\\Acceptance\\Step\\Backend\\Admin' => \TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin::class,
     '\\TYPO3\\Components\\TestingFramework\\Core\\Acceptance\\Step\\Backend\\Editor' => \TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Editor::class,
-    '\\TYPO3\\Components\\TestingFramework\\Core\\Acceptance\\Support\\Helper\\Formhandler' => \TYPO3\TestingFramework\Core\Acceptance\Support\Helper\Formhandler::class,
-    '\\TYPO3\\Components\\TestingFramework\\Core\\Acceptance\\Support\\Helper\\FormHandlerElementTestDataObject' => \TYPO3\TestingFramework\Core\Acceptance\Support\Helper\FormHandlerElementTestDataObject::class,
     '\\TYPO3\\Components\\TestingFramework\\Core\\Acceptance\\Support\\Helper\\ModalDialog' => \TYPO3\TestingFramework\Core\Acceptance\Support\Helper\ModalDialog::class,
     '\\TYPO3\\Components\\TestingFramework\\Core\\Acceptance\\Support\\Helper\\Topbar' => \TYPO3\TestingFramework\Core\Acceptance\Support\Helper\Topbar::class,
     '\\TYPO3\\Components\\TestingFramework\\Core\\Acceptance\\Support\\Page\\PageTree' => \TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree::class,
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/AbstractElementsBasicCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/AbstractElementsBasicCest.php
new file mode 100644 (file)
index 0000000..85333be
--- /dev/null
@@ -0,0 +1,151 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use Facebook\WebDriver\Remote\RemoteWebDriver;
+use Facebook\WebDriver\Remote\RemoteWebElement;
+use Facebook\WebDriver\WebDriverKeys;
+use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
+use TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree;
+
+/**
+ * Abstract class for "elements_basic" tests of styleguide
+ */
+abstract class AbstractElementsBasicCest
+{
+    /**
+     * Set up selects styleguide elements basic page and opens record in FormEngine
+     *
+     * @param Admin $I
+     * @param PageTree $pageTree
+     */
+    public function _before(Admin $I, PageTree $pageTree)
+    {
+        $I->useExistingSession();
+        // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
+        $I->switchToIFrame('list_frame');
+        $I->waitForText('Web Content Management System');
+        $I->switchToIFrame();
+
+        $I->click('List');
+        $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
+        $I->switchToIFrame('list_frame');
+
+        // Open record and wait until form is ready
+        $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
+        $I->waitForElement($editRecordLinkCssPath, 30);
+        $I->click($editRecordLinkCssPath);
+        $I->waitForText('Edit Form', 3, 'h1');
+    }
+
+    /**
+     * Execute given test sets.
+     * Incoming array operates on fields of ext:styleguide, each field can have multiple test tests.
+     *
+     * @param Admin $I
+     * @param array $dataSets
+     */
+    protected function runTests(Admin $I, array $dataSets)
+    {
+        foreach ($dataSets as $fieldLabel => $testData) {
+            $initializedInputFieldXpath = '(//label[contains(text(),"' . $fieldLabel . '")])'
+                . '[1]/parent::*//*/input[@data-formengine-input-name][@data-formengine-input-initialized]';
+            foreach ($testData as $data) {
+                // Wait until JS initialized everything
+                $I->waitForElement($initializedInputFieldXpath, 30);
+
+                $formSection = $this->getFormSectionByFieldLabel($I, $fieldLabel);
+                $inputField = $this->getInputField($formSection);
+                $hiddenField = $this->getHiddenField($formSection, $inputField);
+
+                if ($data['comment'] !== '') {
+                    $I->comment($data['comment']);
+                }
+
+                $I->fillField($inputField, $data['inputValue']);
+                // Change focus to trigger validation
+                $inputField->sendKeys(WebDriverKeys::TAB);
+                // Click on the div so that any opened popup (potentially from the field below) is closed
+                $formSection->click();
+
+                $I->comment('Test value of visible and hidden field');
+                $I->canSeeInField($inputField, $data['expectedValue']);
+                $I->canSeeInField($hiddenField, $data['expectedInternalValue']);
+
+                $I->comment('Save the form');
+                $saveButtonLink = '//*/button[@name="_savedok"][1]';
+                $I->waitForElement($saveButtonLink, 30);
+                $I->click($saveButtonLink);
+                $I->waitForElement('//*/button[@name="_savedok"][not(@disabled)][1]', 30);
+                $I->waitForElement($initializedInputFieldXpath, 30);
+
+                // Find the fields again (after reload of iFrame)
+                $formSection = $this->getFormSectionByFieldLabel($I, $fieldLabel);
+                $inputField = $this->getInputField($formSection);
+                $hiddenField = $this->getHiddenField($formSection, $inputField);
+
+                // Validate save was successful
+                $I->comment('Test value of visible and hidden field');
+                $I->canSeeInField($inputField, $data['expectedValue']);
+                $I->canSeeInField($hiddenField, $data['expectedValueAfterSave']);
+            }
+        }
+    }
+
+    /**
+     * Return the visible input field of element in question.
+     *
+     * @param $formSection
+     * @return RemoteWebElement
+     */
+    protected function getInputField(RemoteWebElement $formSection)
+    {
+        return $formSection->findElement(\WebDriverBy::xpath('.//*/input[@data-formengine-input-name]'));
+    }
+
+    /**
+     * Return the hidden input field of element in question.
+     *
+     * @param RemoteWebElement $formSection
+     * @param RemoteWebElement $inputField
+     * @return RemoteWebElement
+     */
+    protected function getHiddenField(RemoteWebElement $formSection, RemoteWebElement $inputField)
+    {
+        $hiddenFieldXPath = './/*/input[@name="' . $inputField->getAttribute('data-formengine-input-name') . '"]';
+        return $formSection->findElement(\WebDriverBy::xpath($hiddenFieldXPath));
+    }
+
+    /**
+     * Find this element in form.
+     *
+     * @param Admin $I
+     * @param string $fieldLabel
+     * @return RemoteWebElement
+     */
+    protected function getFormSectionByFieldLabel(Admin $I, string $fieldLabel)
+    {
+        $I->comment('Get context for field "' . $fieldLabel . '"');
+        return $I->executeInSelenium(
+            function (RemoteWebDriver $webDriver) use ($fieldLabel) {
+                return $webDriver->findElement(
+                    \WebDriverBy::xpath(
+                        '(//label[contains(text(),"' . $fieldLabel . '")])[1]/ancestor::fieldset[@class="form-section"][1]'
+                    )
+                );
+            }
+        );
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicCest.php
deleted file mode 100644 (file)
index 393615f..0000000
+++ /dev/null
@@ -1,620 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
-use TYPO3\TestingFramework\Core\Acceptance\Support\Helper\Formhandler;
-use TYPO3\TestingFramework\Core\Acceptance\Support\Helper\FormHandlerElementTestDataObject;
-use TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree;
-
-/**
- * Tests for basic element fields
- */
-class ElementsBasicCest
-{
-    /**
-     * Selector of the record container in the listview
-     *
-     * @var string
-     */
-    protected static $listViewRecordSelector = '#recordlist-tx_styleguide_elements_basic';
-
-    public function _before(Admin $I, PageTree $pageTree)
-    {
-        $I->useExistingSession();
-        // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
-        $I->switchToIFrame('list_frame');
-        $I->waitForText('Web Content Management System');
-        $I->switchToIFrame();
-
-        $I->click('List');
-        $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
-        $I->switchToIFrame('list_frame');
-    }
-
-    /**
-     * @param Admin $I
-     * @param Formhandler $formhandler
-     */
-    public function checkThatBrowserSideValidationsWorksForTextAndSaveRecord(Admin $I, Formhandler $formhandler)
-    {
-        $this->waitForFormReady($I);
-
-        $fieldTests = [
-            'input_1' => [
-                new FormHandlerElementTestDataObject(
-                    'This is a demo text with 2 numbers #!',
-                    'This is a demo text with 2 numbers #!'
-                )
-            ],
-            'input_2, size=10' => [
-                new FormHandlerElementTestDataObject(
-                    'This is a demo text with 2 numbers #!',
-                    'This is a demo text with 2 numbers #!'
-                )
-            ],
-            'input_3 max=4' => [
-                new FormHandlerElementTestDataObject(
-                    'Kasper',
-                    'Kasp'
-                )
-            ],
-            'input_4 eval=alpha' => [
-                new FormHandlerElementTestDataObject(
-                    'Kasper = TYPO3',
-                    'KasperTYPO'
-                ),
-                new FormHandlerElementTestDataObject(
-                    'Non-latin characters: ŠĐŽĆČ',
-                    'Nonlatincharacters'
-                ),
-            ],
-            'input_5 eval=alphanum' => [
-                new FormHandlerElementTestDataObject(
-                    'Kasper = TYPO3',
-                    'KasperTYPO3'
-                ),
-
-            ],
-            'input_10 eval=is_in, is_in=abc123' => [
-                new FormHandlerElementTestDataObject(
-                    'abcd1234',
-                    'abc123'
-                ),
-                new FormHandlerElementTestDataObject(
-                    'Kasper TYPO3',
-                    'a3'
-                )
-            ],
-            'input_11 eval=lower' => [
-                new FormHandlerElementTestDataObject(
-                    'Kasper TYPO3!',
-                    'kasper typo3!'
-                )
-            ],
-            'input_13 eval=nospace' => [
-                new FormHandlerElementTestDataObject(
-                    ' Kasper TYPO3! ',
-                    'KasperTYPO3!'
-                )
-            ],
-            'input_16 eval=password' => [
-                new FormHandlerElementTestDataObject(
-                    'Kasper',
-                    '********',
-                    'Kasper'
-                ),
-            ],
-            'input_19 eval=trim' => [
-                new FormHandlerElementTestDataObject(
-                    ' Kasper ',
-                    'Kasper'
-                ),
-                new FormHandlerElementTestDataObject(
-                    ' Kasper TYPO3 ',
-                    'Kasper TYPO3'
-                ),
-            ],
-            'input_23 eval=upper' => [
-                new FormHandlerElementTestDataObject(
-                    'Kasper TYPO3!',
-                    'KASPER TYPO3!'
-                )
-            ],
-        ];
-        foreach ($fieldTests as $fieldLabel => $testData) {
-            $formhandler->fillSeeSaveAndClearInputField(
-                $fieldLabel,
-                $testData
-            );
-        }
-    }
-
-    /**
-     * @param Admin $I
-     * @param Formhandler $formhandler
-     */
-    public function checkThatBrowserSideValidationsWorkForNumericAndSaveRecord(Admin $I, Formhandler $formhandler)
-    {
-        $this->waitForFormReady($I);
-
-        $fieldTests = [
-
-            'input_8 eval=double2' => [
-                new FormHandlerElementTestDataObject(
-                    '12.335',
-                    '12.34',
-                    '12.34'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12,335',
-                    '12.34',
-                    '12.34'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '1.1',
-                    '1.10',
-                    '1.10'
-                ),
-                new FormHandlerElementTestDataObject(
-                    'TYPO3',
-                    '3.00',
-                    '3.00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '3TYPO',
-                    '3.00',
-                    '3.00'
-                )
-            ],
-            'input_9 eval=int' => [
-                new FormHandlerElementTestDataObject(
-                    '12.335',
-                    '12',
-                    '12'
-
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12,9',
-                    '12',
-                    '12'
-                ),
-                new FormHandlerElementTestDataObject(
-                    'TYPO3',
-                    '0',
-                    '0'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '3TYPO',
-                    '3',
-                    '3'
-                )
-            ],
-            'input_15 eval=num' => [
-                new FormHandlerElementTestDataObject(
-                    '12.335',
-                    '12335'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12,9',
-                    '129'
-                ),
-                new FormHandlerElementTestDataObject(
-                    'TYPO3',
-                    '3'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '3TYPO',
-                    '3'
-                ),
-            ],
-        ];
-
-        foreach ($fieldTests as $fieldLabel => $testData) {
-            $formhandler->fillSeeSaveAndClearInputField(
-                $fieldLabel,
-                $testData
-            );
-        }
-    }
-
-    /**
-     * @param Admin $I
-     * @param Formhandler $formhandler
-     */
-    public function checkThatBrowserSideValidationsWorkForRangeAndSaveRecord(Admin $I, Formhandler $formhandler)
-    {
-        $this->waitForFormReady($I);
-
-        $fieldTests = [
-
-            'input_25 eval=int, default=0, range lower=-2, range upper=2' => [
-                new FormHandlerElementTestDataObject(
-                    'Kasper TYPO3',
-                    '0',
-                    '0'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '2',
-                    '2',
-                    '2'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '-1',
-                    '-1',
-                    '-1'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '-3',
-                    '-3',
-                    '-3',
-                    '-3',
-                    true,
-                    'Expecting a modal with error on trying to save.'
-
-                ),
-                new FormHandlerElementTestDataObject(
-                    '3',
-                    '-3',
-                    '-3',
-                    '-3',
-                    true,
-                    'Expecting a modal with error on trying to save.'
-                )
-            ],
-        ];
-
-        foreach ($fieldTests as $fieldLabel => $testData) {
-            $formhandler->fillSeeSaveAndClearInputField(
-                $fieldLabel,
-                $testData
-            );
-        }
-    }
-
-    /**
-     * @param Admin $I
-     * @param Formhandler $formhandler
-     */
-    public function checkThatBrowserSideValidationsWorkForMd5AndSaveRecord(Admin $I, Formhandler $formhandler)
-    {
-        $this->waitForFormReady($I);
-
-        $fieldTests = [
-            'input_12 eval=md5' => [
-                new FormHandlerElementTestDataObject(
-                    'Kasper TYPO3!',
-                    '748469dd64911af8df8f9a3dcb2c9378',
-                    '748469dd64911af8df8f9a3dcb2c9378'
-                ),
-                new FormHandlerElementTestDataObject(
-                    ' Kasper TYPO3! ',
-                    '792a085606250c47d6ebb8c98804d5b0',
-                    '792a085606250c47d6ebb8c98804d5b0',
-                    '792a085606250c47d6ebb8c98804d5b0',
-                    false,
-                    'Check that whitespaces are not trimmed.'
-                )
-            ],
-        ];
-
-        foreach ($fieldTests as $fieldLabel => $testData) {
-            $formhandler->fillSeeSaveAndClearInputField(
-                $fieldLabel,
-                $testData
-            );
-        }
-    }
-
-    /**
-     * @param Admin $I
-     * @param Formhandler $formhandler
-     */
-    public function checkThatValidationWorks_evalYear(Admin $I, Formhandler $formhandler)
-    {
-        $this->waitForFormReady($I);
-
-        $testData = [
-            'input_24 eval=year' => [
-                new FormHandlerElementTestDataObject(
-                    '2016',
-                    '2016',
-                    '2016'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12',
-                    '2012',
-                    '2012'
-                ),
-                new FormHandlerElementTestDataObject(
-                    'Kasper',
-                    date('Y'),
-                    date('Y'),
-                    date('Y'),
-                    false,
-                    'Invalid character is converted to current year'
-                )
-            ]
-        ];
-
-        $this->runTests($formhandler, $testData);
-    }
-
-    /**
-     * @param \TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin $I
-     * @param \TYPO3\TestingFramework\Core\Acceptance\Support\Helper\Formhandler $formhandler
-     * @skip
-     */
-    public function checkThatBrowserSideValidationWorks_EvalDate(Admin $I, Formhandler $formhandler)
-    {
-        $this->skip('Instable Test is skipped due to repeated failure');
-        //@todo fix this test
-
-        $this->waitForFormReady($I);
-        $fieldData = [
-            'input_6 eval=date' => [
-                new FormHandlerElementTestDataObject(
-                    '29-01-2016',
-                    '29-01-2016',
-                    '2016-01-29T00:00:00Z',
-                    '2016-01-29T00:00:00+00:00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '13-13-2016',
-                    '13-01-2017',
-                    '2017-01-13T00:00:00Z',
-                    '2017-01-13T00:00:00+00:00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '29-02-2016',
-                    '29-02-2016',
-                    '2016-02-29T00:00:00Z',
-                    '2016-02-29T00:00:00+00:00',
-                    false,
-                    'Check valid leap year input'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '29-02-2015',
-                    '01-03-2015',
-                    '2015-03-01T00:00:00Z',
-                    '2015-03-01T00:00:00+00:00',
-                    false,
-                    'Check invalid leap year transformation'
-                )
-            ]
-        ];
-        $this->runTests($formhandler, $fieldData);
-    }
-
-    public function checkThatValidationWorks_EvalDate_TypeDate(Admin $I, Formhandler $formhandler)
-    {
-        $this->waitForFormReady($I);
-        $testData = [
-            'input_36 dbType=date eval=date' => [
-                new FormHandlerElementTestDataObject(
-                    '29-01-2016',
-                    '29-01-2016',
-                    '2016-01-29T00:00:00Z',
-                    '2016-01-29T00:00:00+00:00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '13-13-2016',
-                    '13-01-2017',
-                    '2017-01-13T00:00:00Z',
-                    '2017-01-13T00:00:00+00:00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '29-02-2016',
-                    '29-02-2016',
-                    '2016-02-29T00:00:00Z',
-                    '2016-02-29T00:00:00+00:00',
-                    false,
-                    'Check valid leap year input'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '29-02-2015',
-                    '01-03-2015',
-                    '2015-03-01T00:00:00Z',
-                    '2015-03-01T00:00:00+00:00',
-                    false,
-                    'Check invalid leap year transformation'
-                ),
-            ]
-        ];
-        $this->runTests($formhandler, $testData);
-    }
-
-    public function checkThatValidationWorks_EvalDateTime(Admin $I, Formhandler $formhandler)
-    {
-        $this->waitForFormReady($I);
-        $testData = [
-            'input_7 eval=datetime' => [
-                new FormHandlerElementTestDataObject(
-                    '05:23 29-01-2016',
-                    '05:23 29-01-2016',
-                    '2016-01-29T05:23:00Z',
-                    '2016-01-29T05:23:00+00:00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '05:23 13-13-2016',
-                    '05:23 13-01-2017',
-                    '2017-01-13T05:23:00Z',
-                    '2017-01-13T05:23:00+00:00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '05:23 29-02-2016',
-                    '05:23 29-02-2016',
-                    '2016-02-29T05:23:00Z',
-                    '2016-02-29T05:23:00+00:00',
-                    false,
-                    'Check valid leap year input'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '05:23 29-02-2015',
-                    '05:23 01-03-2015',
-                    '2015-03-01T05:23:00Z',
-                    '2015-03-01T05:23:00+00:00',
-                    false,
-                    'Check invalid leap year transformation'
-                )
-            ]
-        ];
-        $this->runTests($formhandler, $testData);
-    }
-
-    public function checkThatValidationWorks_EvalDateTime_DbTypeDateTime(Admin $I, Formhandler $formhandler)
-    {
-        $this->skip('Instable Test is skipped due to repeated failure');
-        //@todo fix this test
-        $this->waitForFormReady($I);
-        $testData = [
-            'input_37 dbType=datetime eval=datetime' => [
-                new FormHandlerElementTestDataObject(
-                    '05:23 29-01-2016',
-                    '05:23 29-01-2016',
-                    '2016-01-29T05:23:00Z',
-                    '2016-01-29T05:23:00+00:00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '05:23 13-13-2016',
-                    '05:23 13-01-2017',
-                    '2017-01-13T05:23:00Z',
-                    '2017-01-13T05:23:00+00:00'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '05:23 29-02-2016',
-                    '05:23 29-02-2016',
-                    '2016-02-29T05:23:00Z',
-                    '2016-02-29T05:23:00+00:00',
-                    false,
-                    'Check valid leap year input'
-                ),
-                new FormHandlerElementTestDataObject(
-                    '05:23 29-02-2015',
-                    '05:23 01-03-2015',
-                    '2015-03-01T05:23:00Z',
-                    '2015-03-01T05:23:00+00:00',
-                    false,
-                    'Check invalid leap year transformation'
-                ),
-            ],
-        ];
-        $this->runTests($formhandler, $testData);
-    }
-
-    public function checkThatValidationWorks_evalTime(Admin $I, Formhandler $formhandler)
-    {
-        $this->waitForFormReady($I);
-        $testData = [
-            'input_17 eval=time' => [
-                new FormHandlerElementTestDataObject(
-                    '13:30',
-                    '13:30',
-                    '13:30',
-                    (new \DateTime('13:30'))->getTimestamp()
-                ),
-                new FormHandlerElementTestDataObject(
-                    '123',
-                    '12:03',
-                    '12:03',
-                    (new \DateTime('12:03'))->getTimestamp()
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12345',
-                    '12:34',
-                    '12:34',
-                    (new \DateTime('12:34'))->getTimestamp()
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12:04+5',
-                    '12:09',
-                    '12:09',
-                    (new \DateTime('12:09'))->getTimestamp()
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12:09-3',
-                    '12:06',
-                    '12:06',
-                    (new \DateTime('12:06'))->getTimestamp()
-                )
-            ],
-        ];
-        $this->runTests($formhandler, $testData);
-    }
-
-    public function checkThatValidationWorks_evalTimesec(Admin $I, Formhandler $formhandler)
-    {
-        $this->skip('Instable Test is skipped due to repeated failure');
-        //@todo fix this test
-
-        $this->waitForFormReady($I);
-        $testData = [
-            'input_18 eval=timesec' => [
-                new FormHandlerElementTestDataObject(
-                    '13:30:00',
-                    '13:30:00',
-                    '13:30:00',
-                    (new \DateTime('13:30:00'))->getTimestamp()
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12345',
-                    '12:34:05',
-                    '12:34:05',
-                    (new \DateTime('12:34:05'))->getTimestamp()
-                ),
-                new FormHandlerElementTestDataObject(
-                    '12:04:04+5',
-                    '12:09:04',
-                    '12:09:04',
-                    (new \DateTime('12:09:04'))->getTimestamp()
-                )
-            ],
-        ];
-        $this->runTests($formhandler, $testData);
-    }
-
-    /**
-     * @param \TYPO3\TestingFramework\Core\Acceptance\Support\Helper\Formhandler $formhandler
-     * @param $fieldData
-     */
-    protected function runTests(Formhandler $formhandler, $fieldData)
-    {
-        foreach ($fieldData as $fieldLabel => $testData) {
-            $formhandler->fillSeeSaveAndClearInputField(
-                $fieldLabel,
-                $testData
-            );
-        }
-    }
-
-    /**
-     * @param \TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin $I
-     */
-    protected function waitForFormReady(Admin $I)
-    {
-        $editRecordLinkCssPath = self::$listViewRecordSelector . ' a[data-original-title="Edit record"]';
-        $I->waitForElement($editRecordLinkCssPath, 30);
-        $I->click($editRecordLinkCssPath);
-        $I->waitForText('Edit Form', 3, 'h1');
-    }
-
-    /**
-     * From Codeception/Scenario
-     */
-    protected function skip($message)
-    {
-        throw new \PHPUnit_Framework_SkippedTestError($message);
-    }
-}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicInputCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicInputCest.php
new file mode 100644 (file)
index 0000000..7890b6b
--- /dev/null
@@ -0,0 +1,309 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
+
+/**
+ * Tests for "elements_basic" simple input fields of ext:styleguide
+ */
+class ElementsBasicInputCest extends AbstractElementsBasicCest
+{
+    /**
+     * @param Admin $I
+     */
+    public function testFieldHandlingOfSimpleFields(Admin $I)
+    {
+        $dataSets = [
+            'input_1' => [
+                [
+                    'inputValue' => 'This is a demo text',
+                    'expectedValue' => 'This is a demo text',
+                    'expectedInternalValue' => 'This is a demo text',
+                    'expectedValueAfterSave' => 'This is a demo text',
+                    'comment' => '',
+                ],
+            ],
+            'input_2, size=10' => [
+                [
+                    'inputValue' => 'This is a demo text with numbers and other characters 42 #!',
+                    'expectedValue' => 'This is a demo text with numbers and other characters 42 #!',
+                    'expectedInternalValue' => 'This is a demo text with numbers and other characters 42 #!',
+                    'expectedValueAfterSave' => 'This is a demo text with numbers and other characters 42 #!',
+                    'comment' => '',
+                ],
+            ],
+            'input_3 max=4' => [
+                [
+                    'inputValue' => 'Kasper',
+                    'expectedValue' => 'Kasp',
+                    'expectedInternalValue' => 'Kasp',
+                    'expectedValueAfterSave' => 'Kasp',
+                    'comment' => '',
+                ],
+            ],
+            'input_4 eval=alpha' => [
+                [
+                    'inputValue' => 'Kasper = TYPO3',
+                    'expectedValue' => 'KasperTYPO',
+                    'expectedInternalValue' => 'KasperTYPO',
+                    'expectedValueAfterSave' => 'KasperTYPO',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => 'Non-latin characters: ŠĐŽĆČ',
+                    'expectedValue' => 'Nonlatincharacters',
+                    'expectedInternalValue' => 'Nonlatincharacters',
+                    'expectedValueAfterSave' => 'Nonlatincharacters',
+                    'comment' => '',
+                ],
+            ],
+            'input_5 eval=alphanum' => [
+                [
+                    'inputValue' => 'Kasper = TYPO3',
+                    'expectedValue' => 'KasperTYPO3',
+                    'expectedInternalValue' => 'KasperTYPO3',
+                    'expectedValueAfterSave' => 'KasperTYPO3',
+                    'comment' => '',
+                ],
+            ],
+            'input_10 eval=is_in, is_in=abc123' => [
+                [
+                    'inputValue' => 'abcd1234',
+                    'expectedValue' => 'abc123',
+                    'expectedInternalValue' => 'abc123',
+                    'expectedValueAfterSave' => 'abc123',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => 'Kasper TYPO3',
+                    'expectedValue' => 'a3',
+                    'expectedInternalValue' => 'a3',
+                    'expectedValueAfterSave' => 'a3',
+                    'comment' => '',
+                ],
+            ],
+            'input_11 eval=lower' => [
+                [
+                    'inputValue' => 'Kasper TYPO3!',
+                    'expectedValue' => 'kasper typo3!',
+                    'expectedInternalValue' => 'kasper typo3!',
+                    'expectedValueAfterSave' => 'kasper typo3!',
+                    'comment' => '',
+                ],
+            ],
+            'input_13 eval=nospace' => [
+                [
+                    'inputValue' => ' Kasper TYPO3! ',
+                    'expectedValue' => 'KasperTYPO3!',
+                    'expectedInternalValue' => 'KasperTYPO3!',
+                    'expectedValueAfterSave' => 'KasperTYPO3!',
+                    'comment' => '',
+                ],
+            ],
+            'input_16 eval=password' => [
+                [
+                    'inputValue' => 'Kasper',
+                    'expectedValue' => '********',
+                    'expectedInternalValue' => 'Kasper',
+                    'expectedValueAfterSave' => 'Kasper',
+                    'comment' => '',
+                ],
+            ],
+            'input_19 eval=trim' => [
+                [
+                    'inputValue' => ' Kasper ',
+                    'expectedValue' => 'Kasper',
+                    'expectedInternalValue' => 'Kasper',
+                    'expectedValueAfterSave' => 'Kasper',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => ' Kasper TYPO3 ',
+                    'expectedValue' => 'Kasper TYPO3',
+                    'expectedInternalValue' => 'Kasper TYPO3',
+                    'expectedValueAfterSave' => 'Kasper TYPO3',
+                    'comment' => '',
+                ],
+            ],
+            'input_23 eval=upper' => [
+                [
+                    'inputValue' => 'Kasper TYPO3!',
+                    'expectedValue' => 'KASPER TYPO3!',
+                    'expectedInternalValue' => 'KASPER TYPO3!',
+                    'expectedValueAfterSave' => 'KASPER TYPO3!',
+                    'comment' => '',
+                ],
+            ],
+        ];
+        $this->runTests($I, $dataSets);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function testHandlingOfEvalFields(Admin $I)
+    {
+        $dataSets = [
+            'input_8 eval=double2' => [
+                [
+                    'inputValue' => '12.335',
+                    'expectedValue' => '12.34',
+                    'expectedInternalValue' => '12.34',
+                    'expectedValueAfterSave' => '12.34',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12,335', // comma as delimiter
+                    'expectedValue' => '12.34',
+                    'expectedInternalValue' => '12.34',
+                    'expectedValueAfterSave' => '12.34',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '1.1', // comma as delimiter
+                    'expectedValue' => '1.10',
+                    'expectedInternalValue' => '1.10',
+                    'expectedValueAfterSave' => '1.10',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => 'TYPO3', // comma as delimiter
+                    'expectedValue' => '3.00',
+                    'expectedInternalValue' => '3.00',
+                    'expectedValueAfterSave' => '3.00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '3TYPO', // comma as delimiter
+                    'expectedValue' => '3.00',
+                    'expectedInternalValue' => '3.00',
+                    'expectedValueAfterSave' => '3.00',
+                    'comment' => '',
+                ],
+            ],
+            'input_9 eval=int' => [
+                [
+                    'inputValue' => '12.335',
+                    'expectedValue' => '12',
+                    'expectedInternalValue' => '12',
+                    'expectedValueAfterSave' => '12',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12,9',
+                    'expectedValue' => '12',
+                    'expectedInternalValue' => '12',
+                    'expectedValueAfterSave' => '12',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => 'TYPO3',
+                    'expectedValue' => '0',
+                    'expectedInternalValue' => '0',
+                    'expectedValueAfterSave' => '0',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '3TYPO',
+                    'expectedValue' => '3',
+                    'expectedInternalValue' => '3',
+                    'expectedValueAfterSave' => '3',
+                    'comment' => '',
+                ],
+            ],
+            'input_15 eval=num' => [
+                [
+                    'inputValue' => '12.335',
+                    'expectedValue' => '12335',
+                    'expectedInternalValue' => '12335',
+                    'expectedValueAfterSave' => '12335',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12,9',
+                    'expectedValue' => '129',
+                    'expectedInternalValue' => '129',
+                    'expectedValueAfterSave' => '129',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => 'TYPO3',
+                    'expectedValue' => '3',
+                    'expectedInternalValue' => '3',
+                    'expectedValueAfterSave' => '3',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '3TYPO',
+                    'expectedValue' => '3',
+                    'expectedInternalValue' => '3',
+                    'expectedValueAfterSave' => '3',
+                    'comment' => '',
+                ],
+            ],
+        ];
+        $this->runTests($I, $dataSets);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function testHandlingOfRangeAndMd5Fields(Admin $I)
+    {
+        $dataSets = [
+            'input_25 eval=int, default=0, range lower=-2, range upper=2' => [
+                [
+                    'inputValue' => 'Kasper TYPO3',
+                    'expectedValue' => '0',
+                    'expectedInternalValue' => '0',
+                    'expectedValueAfterSave' => '0',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '2',
+                    'expectedValue' => '2',
+                    'expectedInternalValue' => '2',
+                    'expectedValueAfterSave' => '2',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '-1',
+                    'expectedValue' => '-1',
+                    'expectedInternalValue' => '-1',
+                    'expectedValueAfterSave' => '-1',
+                    'comment' => '',
+                ],
+            ],
+            'input_12 eval=md5' => [
+                [
+                    'inputValue' => 'Kasper TYPO3!',
+                    'expectedValue' => '748469dd64911af8df8f9a3dcb2c9378',
+                    'expectedInternalValue' => '748469dd64911af8df8f9a3dcb2c9378',
+                    'expectedValueAfterSave' => '748469dd64911af8df8f9a3dcb2c9378',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => ' Kasper TYPO3! ',
+                    'expectedValue' => '792a085606250c47d6ebb8c98804d5b0',
+                    'expectedInternalValue' => '792a085606250c47d6ebb8c98804d5b0',
+                    'expectedValueAfterSave' => '792a085606250c47d6ebb8c98804d5b0',
+                    'comment' => 'Check whitespaces are not trimmed.',
+                ],
+            ],
+        ];
+        $this->runTests($I, $dataSets);
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicInputDateCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Formhandler/ElementsBasicInputDateCest.php
new file mode 100644 (file)
index 0000000..8d0f72b
--- /dev/null
@@ -0,0 +1,279 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
+
+/**
+ * Tests for "elements_basic" date and time related input fields of ext:styleguide
+ */
+class ElementsBasicInputDateCest extends AbstractElementsBasicCest
+{
+    /**
+     * @param Admin $I
+     */
+    public function checkThatValidationWorks_evalYear(Admin $I)
+    {
+        $dataSets = [
+            'input_24 eval=year' => [
+                [
+                    'inputValue' => '2016',
+                    'expectedValue' => '2016',
+                    'expectedInternalValue' => '2016',
+                    'expectedValueAfterSave' => '2016',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12',
+                    'expectedValue' => '2012',
+                    'expectedInternalValue' => '2012',
+                    'expectedValueAfterSave' => '2012',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => 'Kasper',
+                    'expectedValue' => date('Y'),
+                    'expectedInternalValue' => date('Y'),
+                    'expectedValueAfterSave' => date('Y'),
+                    'comment' => 'Invalid character is converted to current year',
+                ],
+            ]
+        ];
+        $this->runTests($I, $dataSets);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function checkThatValidationWorks_EvalDate_TypeDate(Admin $I)
+    {
+        $dataSets = [
+            'input_36 dbType=date eval=date' => [
+                [
+                    'inputValue' => '29-01-2016',
+                    'expectedValue' => '29-01-2016',
+                    'expectedInternalValue' => '2016-01-29T00:00:00Z',
+                    'expectedValueAfterSave' => '2016-01-29T00:00:00+00:00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '13-13-2016',
+                    'expectedValue' => '13-01-2017',
+                    'expectedInternalValue' => '2017-01-13T00:00:00Z',
+                    'expectedValueAfterSave' => '2017-01-13T00:00:00+00:00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '29-02-2016',
+                    'expectedValue' => '29-02-2016',
+                    'expectedInternalValue' => '2016-02-29T00:00:00Z',
+                    'expectedValueAfterSave' => '2016-02-29T00:00:00+00:00',
+                    'comment' => 'Check valid leap year input',
+                ],
+                [
+                    'inputValue' => '29-02-2015',
+                    'expectedValue' => '01-03-2015',
+                    'expectedInternalValue' => '2015-03-01T00:00:00Z',
+                    'expectedValueAfterSave' => '2015-03-01T00:00:00+00:00',
+                    'comment' => 'Check invalid leap year transformation',
+                ],
+            ]
+        ];
+        $this->runTests($I, $dataSets);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function checkThatValidationWorks_EvalDateTime(Admin $I)
+    {
+        $dataSets = [
+            'input_7 eval=datetime' => [
+                [
+                    'inputValue' => '05:23 29-01-2016',
+                    'expectedValue' => '05:23 29-01-2016',
+                    'expectedInternalValue' => '2016-01-29T05:23:00Z',
+                    'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '05:23 13-13-2016',
+                    'expectedValue' => '05:23 13-01-2017',
+                    'expectedInternalValue' => '2017-01-13T05:23:00Z',
+                    'expectedValueAfterSave' => '2017-01-13T05:23:00+00:00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '05:23 29-02-2016',
+                    'expectedValue' => '05:23 29-02-2016',
+                    'expectedInternalValue' => '2016-02-29T05:23:00Z',
+                    'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
+                    'comment' => 'Check valid leap year input',
+                ],
+                [
+                    'inputValue' => '05:23 29-02-2015',
+                    'expectedValue' => '05:23 01-03-2015',
+                    'expectedInternalValue' => '2015-03-01T05:23:00Z',
+                    'expectedValueAfterSave' => '2015-03-01T05:23:00+00:00',
+                    'comment' => 'Check invalid leap year transformation',
+                ],
+            ]
+        ];
+        $this->runTests($I, $dataSets);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function checkThatValidationWorks_evalTime(Admin $I)
+    {
+        $dataSets = [
+            'input_17 eval=time' => [
+                [
+                    'inputValue' => '13:30',
+                    'expectedValue' => '13:30',
+                    'expectedInternalValue' => '13:30',
+                    'expectedValueAfterSave' => (new \DateTime('13:30'))->getTimestamp(),
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '123',
+                    'expectedValue' => '12:03',
+                    'expectedInternalValue' => '12:03',
+                    'expectedValueAfterSave' => (new \DateTime('12:03'))->getTimestamp(),
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12345',
+                    'expectedValue' => '12:34',
+                    'expectedInternalValue' => '12:34',
+                    'expectedValueAfterSave' => (new \DateTime('12:34'))->getTimestamp(),
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12:04+5',
+                    'expectedValue' => '12:09',
+                    'expectedInternalValue' => '12:09',
+                    'expectedValueAfterSave' => (new \DateTime('12:09'))->getTimestamp(),
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12:09-3',
+                    'expectedValue' => '12:06',
+                    'expectedInternalValue' => '12:06',
+                    'expectedValueAfterSave' => (new \DateTime('12:06'))->getTimestamp(),
+                    'comment' => '',
+                ],
+            ],
+        ];
+        $this->runTests($I, $dataSets);
+    }
+
+    /**
+     * @param Admin $I
+     */
+    /**
+    public function checkThatValidationWorks_EvalDateTime_DbTypeDateTime(Admin $I)
+    {
+        // @todo fix these unstable test
+        $dataSets = [
+            'input_37 dbType=datetime eval=datetime' => [
+                [
+                    'inputValue' => '05:23 29-01-2016',
+                    'expectedValue' => '05:23 29-01-2016',
+                    'expectedInternalValue' => '2016-01-29T05:23:00Z',
+                    'expectedValueAfterSave' => '2016-01-29T05:23:00+00:00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '05:23 13-13-2016',
+                    'expectedValue' => '05:23 13-01-2017',
+                    'expectedInternalValue' => '2017-01-13T05:23:00Z',
+                    'expectedValueAfterSave' => '2017-01-13T05:23:00+00:00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '05:23 29-02-2016',
+                    'expectedValue' => '05:23 29-02-2016',
+                    'expectedInternalValue' => '2016-02-29T05:23:00Z',
+                    'expectedValueAfterSave' => '2016-02-29T05:23:00+00:00',
+                    'comment' => 'Check valid leap year input',
+                ],
+                [
+                    'inputValue' => '05:23 29-02-2015',
+                    'expectedValue' => '05:23 01-03-2015',
+                    'expectedInternalValue' => '2015-03-01T05:23:00Z',
+                    'expectedValueAfterSave' => '2015-03-01T05:23:00+00:00',
+                    'comment' => 'Check invalid leap year transformation',
+                ],
+            ],
+            'input_18 eval=timesec' => [
+                [
+                    'inputValue' => '13:30:00',
+                    'expectedValue' => '13:30:00',
+                    'expectedInternalValue' => '13:30:00',
+                    'expectedValueAfterSave' => (new \DateTime('13:30:00'))->getTimestamp(),
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12345',
+                    'expectedValue' => '12:34:05',
+                    'expectedInternalValue' => '12:34:05',
+                    'expectedValueAfterSave' => (new \DateTime('12:34:05'))->getTimestamp(),
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '12:04:04+5',
+                    'expectedValue' => '12:09:04',
+                    'expectedInternalValue' => '12:09:04',
+                    'expectedValueAfterSave' => (new \DateTime('12:09:04'))->getTimestamp(),
+                    'comment' => '',
+                ],
+            ],
+            'input_6 eval=date' => [
+                [
+                    'inputValue' => '29-01-2016',
+                    'expectedValue' => '29-01-2016',
+                    'expectedInternalValue' => '2016-01-29T00:00:00Z',
+                    'expectedValueAfterSave' => '2016-01-29T00:00:00+00:00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '13-13-2016',
+                    'expectedValue' => '13-01-2017',
+                    'expectedInternalValue' => '2017-01-13T00:00:00Z',
+                    'expectedValueAfterSave' => '2017-01-13T00:00:00+00:00',
+                    'comment' => '',
+                ],
+                [
+                    'inputValue' => '29-02-2016',
+                    'expectedValue' => '29-02-2016',
+                    'expectedInternalValue' => '2016-02-29T00:00:00Z',
+                    'expectedValueAfterSave' => '2016-02-29T00:00:00+00:00',
+                    'comment' => 'Check valid leap year input',
+                ],
+                [
+                    'inputValue' => '29-02-2015',
+                    'expectedValue' => '01-03-2015',
+                    'expectedInternalValue' => '2015-03-01T00:00:00Z',
+                    'expectedValueAfterSave' => '2015-03-01T00:00:00+00:00',
+                    'comment' => 'Check invalid leap year transformation',
+                ],
+            ],
+        ];
+        $this->runTests($I, $dataSets);
+    }
+     */
+}
index 8bcdbf5..6fe2359 100644 (file)
@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Formhandler;
 
 use Facebook\WebDriver\WebDriverKeys;
 use TYPO3\TestingFramework\Core\Acceptance\Step\Backend\Admin;
-use TYPO3\TestingFramework\Core\Acceptance\Support\Helper\Formhandler;
 use TYPO3\TestingFramework\Core\Acceptance\Support\Helper\ModalDialog;
 use TYPO3\TestingFramework\Core\Acceptance\Support\Page\PageTree;
 
@@ -73,9 +72,8 @@ class Inline1nCest
 
     /**
      * @param Admin $I
-     * @param Formhandler $formhandler
      */
-    public function createInline1nInlineElement(Admin $I, Formhandler $formhandler)
+    public function createInline1nInlineElement(Admin $I)
     {
         $I->click('span[data-identifier="actions-document-new"]', 'div.typo3-newRecordLink');