From b17e93037e08ec3c72b39b6213d6445952c98ce9 Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Mon, 23 Jul 2018 14:02:27 +0200
Subject: [PATCH] [TASK] Use new acceptance test splitter script

The script to split acceptance tests into chunks has been
rewritten in typo3/testing-framework and is used in pre-merge
and nightly plan. It should lead to a more fair split into
single jobs so they end up with similar runtimes again.
One test file is additionally split into three to allow
better distribution.

composer update typo3/testing-framework

Resolves: #85618
Releases: master
Change-Id: Ic65c29c5d0e4813d3953d1e70bd0c746df2b8ff4
Reviewed-on: https://review.typo3.org/57658
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../src/main/java/core/AbstractCoreSpec.java  |  13 +-
 .../src/main/java/core/PreMergeSpec.java      |   2 +-
 composer.lock                                 |  10 +-
 .../FormEngine/ElementsBasicInputEvalCest.php | 173 ++++++++++++++++
 .../ElementsBasicInputRangeCest.php           | 109 ++++++++++
 ...t.php => ElementsBasicInputSimpleCest.php} | 190 +-----------------
 6 files changed, 301 insertions(+), 196 deletions(-)
 create mode 100644 typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputEvalCest.php
 create mode 100644 typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputRangeCest.php
 rename typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/{ElementsBasicInputCest.php => ElementsBasicInputSimpleCest.php} (52%)

diff --git a/Build/bamboo/src/main/java/core/AbstractCoreSpec.java b/Build/bamboo/src/main/java/core/AbstractCoreSpec.java
index 76a4a1d9c817..b59dae604dae 100644
--- a/Build/bamboo/src/main/java/core/AbstractCoreSpec.java
+++ b/Build/bamboo/src/main/java/core/AbstractCoreSpec.java
@@ -376,7 +376,18 @@ abstract public class AbstractCoreSpec {
                         .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
                         .inlineBody(
                             this.getScriptTaskBashInlineBody() +
-                            "./" + this.testingFrameworkBuildPath + "Scripts/splitAcceptanceTests.sh " + numberOfChunks + "\n"
+                            "function splitAcceptanceTests() {\n" +
+                            "    docker run \\\n" +
+                            "        -u ${HOST_UID} \\\n" +
+                            "        -v /bamboo-data/${BAMBOO_COMPOSE_PROJECT_NAME}/passwd:/etc/passwd \\\n" +
+                            "        -v ${BAMBOO_COMPOSE_PROJECT_NAME}_bamboo-data:/srv/bamboo/xml-data/build-dir/ \\\n" +
+                            "        --name ${BAMBOO_COMPOSE_PROJECT_NAME}sib_adhoc \\\n" +
+                            "        --rm \\\n" +
+                            "        typo3gmbh/" + requirementIdentifier.toLowerCase() + ":latest \\\n" +
+                            "        bin/bash -c \"cd ${PWD}; ./" + this.testingFrameworkBuildPath + "Scripts/splitAcceptanceTests.php $*\"\n" +
+                            "}\n" +
+                            "\n" +
+                            "splitAcceptanceTests " + numberOfChunks + " -v"
                         ),
                     new ScriptTask()
                         .description("Execute codeception acceptance suite group " + formattedI)
diff --git a/Build/bamboo/src/main/java/core/PreMergeSpec.java b/Build/bamboo/src/main/java/core/PreMergeSpec.java
index eb507a90fd3b..870c1f8ff232 100644
--- a/Build/bamboo/src/main/java/core/PreMergeSpec.java
+++ b/Build/bamboo/src/main/java/core/PreMergeSpec.java
@@ -44,7 +44,7 @@ public class PreMergeSpec extends AbstractCoreSpec {
     protected static String planName = "Core master pre-merge";
     protected static String planKey = "GTC";
 
-    protected int numberOfAcceptanceTestJobs = 8;
+    protected int numberOfAcceptanceTestJobs = 10;
     protected int numberOfFunctionalMysqlJobs = 10;
     protected int numberOfFunctionalMssqlJobs = 10;
     protected int numberOfFunctionalPgsqlJobs = 10;
diff --git a/composer.lock b/composer.lock
index 6aa7c2e6443f..ae7da8807384 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4617,16 +4617,16 @@
         },
         {
             "name": "typo3/testing-framework",
-            "version": "4.0.1",
+            "version": "4.0.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/TYPO3/testing-framework.git",
-                "reference": "e24b2075122e7fa31d1e91b3024a796e5c725f17"
+                "reference": "dadfd1c953856429ad2a1b9ab8b8bea779e1f960"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/e24b2075122e7fa31d1e91b3024a796e5c725f17",
-                "reference": "e24b2075122e7fa31d1e91b3024a796e5c725f17",
+                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/dadfd1c953856429ad2a1b9ab8b8bea779e1f960",
+                "reference": "dadfd1c953856429ad2a1b9ab8b8bea779e1f960",
                 "shasum": ""
             },
             "require": {
@@ -4673,7 +4673,7 @@
                 "tests",
                 "typo3"
             ],
-            "time": "2018-07-19T20:14:59+00:00"
+            "time": "2018-07-23T11:56:51+00:00"
         },
         {
             "name": "webmozart/assert",
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputEvalCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputEvalCest.php
new file mode 100644
index 000000000000..bbc164d657bc
--- /dev/null
+++ b/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputEvalCest.php
@@ -0,0 +1,173 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine;
+
+/*
+ * 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 Codeception\Example;
+use TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester;
+use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree;
+
+/**
+ * Tests for "elements_basic" eval input fields of ext:styleguide
+ */
+class ElementsBasicInputEvalCest extends AbstractElementsBasicCest
+{
+    /**
+     * Open list module of styleguide elements basic page
+     *
+     * @param BackendTester $I
+     * @param PageTree $pageTree
+     */
+    public function _before(BackendTester $I, PageTree $pageTree)
+    {
+        $I->useExistingSession('admin');
+        $I->click('List');
+        $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
+        $I->switchToContentFrame();
+
+        // Open record and wait until form is ready
+        $I->waitForText('elements basic', 20);
+        $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
+        $I->click($editRecordLinkCssPath);
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->waitForText('Edit Form', 3, 'h1');
+    }
+
+    /**
+     * Test various type=input fields having eval
+     */
+    protected function simpleEvalInputFieldsDataProvider()
+    {
+        return [
+            [
+                'label' => 'input_8 eval=double2',
+                'inputValue' => '12.335',
+                'expectedValue' => '12.34',
+                'expectedInternalValue' => '12.34',
+                'expectedValueAfterSave' => '12.34',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_8 eval=double2',
+                'inputValue' => '12,335', // comma as delimiter
+                'expectedValue' => '12.34',
+                'expectedInternalValue' => '12.34',
+                'expectedValueAfterSave' => '12.34',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_8 eval=double2',
+                'inputValue' => '1.1', // dot as delimiter
+                'expectedValue' => '1.10',
+                'expectedInternalValue' => '1.10',
+                'expectedValueAfterSave' => '1.10',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_8 eval=double2',
+                'inputValue' => 'TYPO3', // word having a number at end
+                'expectedValue' => '3.00',
+                'expectedInternalValue' => '3.00',
+                'expectedValueAfterSave' => '3.00',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_8 eval=double2',
+                'inputValue' => '3TYPO', // word having a number in front
+                'expectedValue' => '3.00',
+                'expectedInternalValue' => '3.00',
+                'expectedValueAfterSave' => '3.00',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_9 eval=int',
+                'inputValue' => '12.335',
+                'expectedValue' => '12',
+                'expectedInternalValue' => '12',
+                'expectedValueAfterSave' => '12',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_9 eval=int',
+                'inputValue' => '12,9',
+                'expectedValue' => '129',
+                'expectedInternalValue' => '129',
+                'expectedValueAfterSave' => '129',
+                'comment' => '',
+            ],
+            /**
+            [
+                // @todo this one probably broke with the html type="number" patch
+                'label' => 'input_9 eval=int',
+                'inputValue' => 'TYPO3',
+                'expectedValue' => '0',
+                'expectedInternalValue' => '0',
+                'expectedValueAfterSave' => '0',
+                'comment' => '',
+            ],
+            */
+            [
+                'label' => 'input_9 eval=int',
+                'inputValue' => '3TYPO',
+                'expectedValue' => '3',
+                'expectedInternalValue' => '3',
+                'expectedValueAfterSave' => '3',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_15 eval=num',
+                'inputValue' => '12.335',
+                'expectedValue' => '12335',
+                'expectedInternalValue' => '12335',
+                'expectedValueAfterSave' => '12335',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_15 eval=num',
+                'inputValue' => '12,9',
+                'expectedValue' => '129',
+                'expectedInternalValue' => '129',
+                'expectedValueAfterSave' => '129',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_15 eval=num',
+                'inputValue' => 'TYPO3',
+                'expectedValue' => '3',
+                'expectedInternalValue' => '3',
+                'expectedValueAfterSave' => '3',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_15 eval=num',
+                'inputValue' => '3TYPO',
+                'expectedValue' => '3',
+                'expectedInternalValue' => '3',
+                'expectedValueAfterSave' => '3',
+                'comment' => '',
+            ],
+        ];
+    }
+
+    /**
+     * @dataProvider simpleEvalInputFieldsDataProvider
+     * @param BackendTester $I
+     * @param Example $testData
+     */
+    public function simpleEvalInputFields(BackendTester $I, Example $testData)
+    {
+        $this->runInputFieldTest($I, $testData);
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputRangeCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputRangeCest.php
new file mode 100644
index 000000000000..44026bf6bd43
--- /dev/null
+++ b/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputRangeCest.php
@@ -0,0 +1,109 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\FormEngine;
+
+/*
+ * 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 Codeception\Example;
+use TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester;
+use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree;
+
+/**
+ * Tests for "elements_basic" range input fields of ext:styleguide
+ */
+class ElementsBasicInputRangeCest extends AbstractElementsBasicCest
+{
+    /**
+     * Open list module of styleguide elements basic page
+     *
+     * @param BackendTester $I
+     * @param PageTree $pageTree
+     */
+    public function _before(BackendTester $I, PageTree $pageTree)
+    {
+        $I->useExistingSession('admin');
+        $I->click('List');
+        $pageTree->openPath(['styleguide TCA demo', 'elements basic']);
+        $I->switchToContentFrame();
+
+        // Open record and wait until form is ready
+        $I->waitForText('elements basic', 20);
+        $editRecordLinkCssPath = '#recordlist-tx_styleguide_elements_basic a[data-original-title="Edit record"]';
+        $I->click($editRecordLinkCssPath);
+        $I->waitForElementNotVisible('#t3js-ui-block');
+        $I->waitForText('Edit Form', 3, 'h1');
+    }
+
+    /**
+     * type=input range and md5 field tests
+     */
+    protected function simpleRangeAndMd5FieldsDataProvider()
+    {
+        return [
+            /**
+            [
+                // @todo this one probably broke with the type="number" patch
+                'label' => 'input_25 eval=int, default=0, range lower=-2, range upper=2',
+                'inputValue' => 'Kasper TYPO3',
+                'expectedValue' => '0',
+                'expectedInternalValue' => '0',
+                'expectedValueAfterSave' => '0',
+                'comment' => '',
+            ],
+             */
+            [
+                'label' => 'input_25 eval=int, default=0, range lower=-2, range upper=2',
+                'inputValue' => '2',
+                'expectedValue' => '2',
+                'expectedInternalValue' => '2',
+                'expectedValueAfterSave' => '2',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_25 eval=int, default=0, range lower=-2, range upper=2',
+                'inputValue' => '-1',
+                'expectedValue' => '-1',
+                'expectedInternalValue' => '-1',
+                'expectedValueAfterSave' => '-1',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_12 eval=md5',
+                'inputValue' => 'Kasper TYPO3!',
+                'expectedValue' => '748469dd64911af8df8f9a3dcb2c9378',
+                'expectedInternalValue' => '748469dd64911af8df8f9a3dcb2c9378',
+                'expectedValueAfterSave' => '748469dd64911af8df8f9a3dcb2c9378',
+                'comment' => '',
+            ],
+            [
+                'label' => 'input_12 eval=md5',
+                'inputValue' => ' Kasper TYPO3! ',
+                'expectedValue' => '792a085606250c47d6ebb8c98804d5b0',
+                'expectedInternalValue' => '792a085606250c47d6ebb8c98804d5b0',
+                'expectedValueAfterSave' => '792a085606250c47d6ebb8c98804d5b0',
+                'comment' => 'Check whitespaces are not trimmed.',
+            ],
+        ];
+    }
+
+    /**
+     * @dataProvider simpleRangeAndMd5FieldsDataProvider
+     * @param BackendTester $I
+     * @param Example $testData
+     */
+    public function simpleRangeAndMd5Fields(BackendTester $I, Example $testData)
+    {
+        $this->runInputFieldTest($I, $testData);
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputSimpleCest.php
similarity index 52%
rename from typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputCest.php
rename to typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputSimpleCest.php
index 40af284397ac..521b6d835ae1 100644
--- a/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputCest.php
+++ b/typo3/sysext/core/Tests/Acceptance/Backend/FormEngine/ElementsBasicInputSimpleCest.php
@@ -22,7 +22,7 @@ use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree;
 /**
  * Tests for "elements_basic" simple input fields of ext:styleguide
  */
-class ElementsBasicInputCest extends AbstractElementsBasicCest
+class ElementsBasicInputSimpleCest extends AbstractElementsBasicCest
 {
     /**
      * Open list module of styleguide elements basic page
@@ -199,192 +199,4 @@ class ElementsBasicInputCest extends AbstractElementsBasicCest
     {
         $this->runInputFieldTest($I, $testData);
     }
-
-    /**
-     * Test various type=input fields having eval
-     */
-    protected function simpleEvalInputFieldsDataProvider()
-    {
-        return [
-            [
-                'label' => 'input_8 eval=double2',
-                'inputValue' => '12.335',
-                'expectedValue' => '12.34',
-                'expectedInternalValue' => '12.34',
-                'expectedValueAfterSave' => '12.34',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_8 eval=double2',
-                'inputValue' => '12,335', // comma as delimiter
-                'expectedValue' => '12.34',
-                'expectedInternalValue' => '12.34',
-                'expectedValueAfterSave' => '12.34',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_8 eval=double2',
-                'inputValue' => '1.1', // dot as delimiter
-                'expectedValue' => '1.10',
-                'expectedInternalValue' => '1.10',
-                'expectedValueAfterSave' => '1.10',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_8 eval=double2',
-                'inputValue' => 'TYPO3', // word having a number at end
-                'expectedValue' => '3.00',
-                'expectedInternalValue' => '3.00',
-                'expectedValueAfterSave' => '3.00',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_8 eval=double2',
-                'inputValue' => '3TYPO', // word having a number in front
-                'expectedValue' => '3.00',
-                'expectedInternalValue' => '3.00',
-                'expectedValueAfterSave' => '3.00',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_9 eval=int',
-                'inputValue' => '12.335',
-                'expectedValue' => '12',
-                'expectedInternalValue' => '12',
-                'expectedValueAfterSave' => '12',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_9 eval=int',
-                'inputValue' => '12,9',
-                'expectedValue' => '129',
-                'expectedInternalValue' => '129',
-                'expectedValueAfterSave' => '129',
-                'comment' => '',
-            ],
-            /**
-            [
-                // @todo this one probably broke with the html type="number" patch
-                'label' => 'input_9 eval=int',
-                'inputValue' => 'TYPO3',
-                'expectedValue' => '0',
-                'expectedInternalValue' => '0',
-                'expectedValueAfterSave' => '0',
-                'comment' => '',
-            ],
-            */
-            [
-                'label' => 'input_9 eval=int',
-                'inputValue' => '3TYPO',
-                'expectedValue' => '3',
-                'expectedInternalValue' => '3',
-                'expectedValueAfterSave' => '3',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_15 eval=num',
-                'inputValue' => '12.335',
-                'expectedValue' => '12335',
-                'expectedInternalValue' => '12335',
-                'expectedValueAfterSave' => '12335',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_15 eval=num',
-                'inputValue' => '12,9',
-                'expectedValue' => '129',
-                'expectedInternalValue' => '129',
-                'expectedValueAfterSave' => '129',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_15 eval=num',
-                'inputValue' => 'TYPO3',
-                'expectedValue' => '3',
-                'expectedInternalValue' => '3',
-                'expectedValueAfterSave' => '3',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_15 eval=num',
-                'inputValue' => '3TYPO',
-                'expectedValue' => '3',
-                'expectedInternalValue' => '3',
-                'expectedValueAfterSave' => '3',
-                'comment' => '',
-            ],
-        ];
-    }
-
-    /**
-     * @dataProvider simpleEvalInputFieldsDataProvider
-     * @param BackendTester $I
-     * @param Example $testData
-     */
-    public function simpleEvalInputFields(BackendTester $I, Example $testData)
-    {
-        $this->runInputFieldTest($I, $testData);
-    }
-
-    /**
-     * type=input range and md5 field tests
-     */
-    protected function simpleRangeAndMd5FieldsDataProvider()
-    {
-        return [
-            /**
-            [
-                // @todo this one probably broke with the type="number" patch
-                'label' => 'input_25 eval=int, default=0, range lower=-2, range upper=2',
-                'inputValue' => 'Kasper TYPO3',
-                'expectedValue' => '0',
-                'expectedInternalValue' => '0',
-                'expectedValueAfterSave' => '0',
-                'comment' => '',
-            ],
-             */
-            [
-                'label' => 'input_25 eval=int, default=0, range lower=-2, range upper=2',
-                'inputValue' => '2',
-                'expectedValue' => '2',
-                'expectedInternalValue' => '2',
-                'expectedValueAfterSave' => '2',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_25 eval=int, default=0, range lower=-2, range upper=2',
-                'inputValue' => '-1',
-                'expectedValue' => '-1',
-                'expectedInternalValue' => '-1',
-                'expectedValueAfterSave' => '-1',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_12 eval=md5',
-                'inputValue' => 'Kasper TYPO3!',
-                'expectedValue' => '748469dd64911af8df8f9a3dcb2c9378',
-                'expectedInternalValue' => '748469dd64911af8df8f9a3dcb2c9378',
-                'expectedValueAfterSave' => '748469dd64911af8df8f9a3dcb2c9378',
-                'comment' => '',
-            ],
-            [
-                'label' => 'input_12 eval=md5',
-                'inputValue' => ' Kasper TYPO3! ',
-                'expectedValue' => '792a085606250c47d6ebb8c98804d5b0',
-                'expectedInternalValue' => '792a085606250c47d6ebb8c98804d5b0',
-                'expectedValueAfterSave' => '792a085606250c47d6ebb8c98804d5b0',
-                'comment' => 'Check whitespaces are not trimmed.',
-            ],
-        ];
-    }
-
-    /**
-     * @dataProvider simpleRangeAndMd5FieldsDataProvider
-     * @param BackendTester $I
-     * @param Example $testData
-     */
-    public function simpleRangeAndMd5Fields(BackendTester $I, Example $testData)
-    {
-        $this->runInputFieldTest($I, $testData);
-    }
 }
-- 
GitLab