[TASK] Acceptance test installing TYPO3 on pgsql 50/53250/14
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 18 Jun 2017 12:05:12 +0000 (14:05 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Fri, 23 Jun 2017 16:42:04 +0000 (18:42 +0200)
A basic acceptance tests clicking through installer
using a postgres sql db connection, checking backend login
and installing the introduction package.

Change-Id: I7408e8580d84e235a1f91399684a80025a62e0e8
Resolves: #81602
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53250
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Build/bamboo/src/main/java/core/AbstractCoreSpec.java
Build/bamboo/src/main/java/core/NightlySpec.java
Build/bamboo/src/main/java/core/PreMergeSpec.java
typo3/sysext/core/Tests/AcceptanceInstallPgsql.suite.yml [new file with mode: 0644]
typo3/sysext/core/Tests/AcceptanceInstallPgsql/InstallWithPgsqlCest.php [new file with mode: 0644]

index f0d5d50..8292b3b 100644 (file)
@@ -114,7 +114,42 @@ abstract public class AbstractCoreSpec {
     }
 
     /**
-     * Jobs for mysql based acceptance tests on a specific php version
+     * Job acceptance test installs system and introduction package on pgsql
+     *
+     * @param Requirement requirement
+     * @param String requirementIdentfier
+     */
+    protected Job getJobAcceptanceTestInstallPgsql(Requirement requirement, String requirementIdentifier) {
+        return new Job("Accept inst pg " + requirementIdentifier, new BambooKey("ACINSTPG" + requirementIdentifier))
+        .description("Install TYPO3 on pgsql and load introduction package " + requirementIdentifier)
+        .tasks(
+            this.getTaskGitCloneRepository(),
+            this.getTaskGitCherryPick(),
+            this.getTaskComposerInstall(),
+            this.getTaskPrepareAcceptanceTest(),
+            new CommandTask()
+                .description("Execute codeception AcceptanceInstallPgsql suite")
+                .executable("codecept")
+                .argument("run AcceptanceInstallPgsql -d -c " + this.testingFrameworkBuildPath + "AcceptanceTestsInstallPgsql.yml --xml reports.xml --html reports.html")
+                .environmentVariables(this.credentialsPgsql)
+        )
+        .finalTasks(
+            new TestParserTask(TestParserTaskProperties.TestType.JUNIT)
+                .resultDirectories("typo3temp/var/tests/AcceptanceReportsInstallPgsql/reports.xml"),
+            this.getTaskDeletePgsqlDatabases(),
+            this.getTaskTearDownAcceptanceTestSetup()
+        )
+        .requirements(
+            requirement
+        )
+        .artifacts(new Artifact()
+            .name("Test Report")
+            .copyPattern("typo3temp/var/tests/AcceptanceReportsInstallPgsql/")
+            .shared(false));
+    }
+
+    /**
+     * Jobs for mysql based acceptance tests
      *
      * @param int numberOfChunks
      * @param Requirement requirement
@@ -165,7 +200,7 @@ abstract public class AbstractCoreSpec {
     }
 
     /**
-     * Jobs for mysql based functional tests on a specific php version
+     * Jobs for mysql based functional tests
      *
      * @param int numberOfChunks
      * @param Requirement requirement
@@ -206,7 +241,7 @@ abstract public class AbstractCoreSpec {
     }
 
     /**
-     * Jobs for mssql based functional tests on a specific php version
+     * Jobs for mssql based functional tests
      *
      * @param int numberOfChunks
      * @param Requirement requirement
@@ -247,7 +282,7 @@ abstract public class AbstractCoreSpec {
     }
 
     /**
-     * Jobs for pgsql based functional tests on a specific php version
+     * Jobs for pgsql based functional tests
      *
      * @param int numberOfChunks
      * @param Requirement requirement
@@ -523,7 +558,7 @@ abstract public class AbstractCoreSpec {
                 "PATCHSET=${bamboo.patchset}\n" +
                 "\n" +
                 "if [[ $CHANGEURL ]]; then\n" +
-                "    gerrit-cherry-pick https://review.typo3.org/Packages/TYPO3.CMS $CHANGEURLID/$PATCHSET\n" +
+                "    gerrit-cherry-pick https://review.typo3.org/Packages/TYPO3.CMS $CHANGEURLID/$PATCHSET || exit 1\n" +
                 "fi\n"
             );
     }
index 3c45105..724f03c 100644 (file)
@@ -77,30 +77,13 @@ public class NightlySpec extends AbstractCoreSpec {
         jobsMainStage.add(this.getJobAcceptanceTestInstallMysql(this.getRequirementPhpVersion70(), "PHP70"));
         jobsMainStage.add(this.getJobAcceptanceTestInstallMysql(this.getRequirementPhpVersion71(), "PHP71"));
 
+        jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql(this.getRequirementPhpVersion70(), "PHP70"));
+        jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql(this.getRequirementPhpVersion71(), "PHP71"));
+
         jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, this.getRequirementPhpVersion70(), "PHP70"));
         jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, this.getRequirementPhpVersion71(), "PHP71"));
 
-        // CGL check whole core
-        jobsMainStage.add(new Job("Integration CGL", new BambooKey("CGLCHECK"))
-            .description("Check coding guidelines of full core")
-            .tasks(
-                this.getTaskGitCloneRepository(),
-                this.getTaskGitCherryPick(),
-                this.getTaskComposerInstall(),
-                new ScriptTask()
-                    .description("Execute cgl check")
-                    .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
-                    .inlineBody(
-                        this.getScriptTaskBashInlineBody() +
-                        this.getScriptTaskBashPhpNoXdebug() +
-                        "php_no_xdebug ./bin/php-cs-fixer fix -v --dry-run --config=Build/.php_cs typo3/\n" +
-                        "exit $?\n"
-                    )
-            )
-            .requirements(
-                this.getRequirementPhpVersion70Or71()
-            )
-        );
+        jobsMainStage.add(this.getJobCglCheckFullCore());
 
         jobsMainStage.add(this.getJobIntegrationVarious());
 
@@ -155,4 +138,29 @@ public class NightlySpec extends AbstractCoreSpec {
                     .notificationForCommitters()
             );
     }
+
+    /**
+     * Job checking CGL of all core php files
+     */
+    protected Job getJobCglCheckFullCore() {
+        return new Job("Integration CGL", new BambooKey("CGLCHECK"))
+            .description("Check coding guidelines of full core")
+            .tasks(
+                this.getTaskGitCloneRepository(),
+                this.getTaskGitCherryPick(),
+                this.getTaskComposerInstall(),
+                new ScriptTask()
+                    .description("Execute cgl check")
+                    .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
+                    .inlineBody(
+                        this.getScriptTaskBashInlineBody() +
+                        this.getScriptTaskBashPhpNoXdebug() +
+                        "php_no_xdebug ./bin/php-cs-fixer fix -v --dry-run --config=Build/.php_cs typo3/\n" +
+                        "exit $?\n"
+                    )
+            )
+            .requirements(
+                this.getRequirementPhpVersion70Or71()
+            );
+    }
 }
index 6505aaf..2ad9c04 100644 (file)
@@ -67,37 +67,9 @@ public class PreMergeSpec extends AbstractCoreSpec {
         // PREPARATION stage
         ArrayList<Job> jobsPreparationStage = new ArrayList<Job>();
 
-        // Label task
-        jobsPreparationStage.add(new Job("Create build labels", new BambooKey("CLFB"))
-            .description("Create changeId and patch set labels from variable access and parsing result of a dummy task")
-            .tasks(
-                new ScriptTask()
-                    .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
-                    .inlineBody("echo \"I'm just here for the labels!\"")
-            )
-        );
+        jobsPreparationStage.add(this.getJobBuildLabels());
 
-        // CGL check last commit
-        jobsPreparationStage.add(new Job("Integration CGL", new BambooKey("CGLCHECK"))
-            .description("Check coding guidelines by executing Build/Scripts/cglFixMyCommit.sh script")
-            .tasks(
-                this.getTaskGitCloneRepository(),
-                this.getTaskGitCherryPick(),
-                this.getTaskComposerInstall(),
-                new ScriptTask()
-                    .description("Execute cgl check script")
-                    .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
-                    .inlineBody(
-                        this.getScriptTaskBashInlineBody() +
-                        "./Build/Scripts/cglFixMyCommit.sh dryrun\n"
-                    )
-            )
-            .requirements(
-                new Requirement("system.phpVersion")
-                    .matchValue("7\\.0|7\\.1")
-                    .matchType(Requirement.MatchType.MATCHES)
-            )
-        );
+        jobsPreparationStage.add(this.getJobCglCheckGitCommit());
 
         jobsPreparationStage.add(this.getJobComposerValidate());
 
@@ -109,6 +81,7 @@ public class PreMergeSpec extends AbstractCoreSpec {
         ArrayList<Job> jobsMainStage = new ArrayList<Job>();
 
         jobsMainStage.add(this.getJobAcceptanceTestInstallMysql(this.getRequirementPhpVersion70Or71(), "PHP7071"));
+        jobsMainStage.add(this.getJobAcceptanceTestInstallPgsql(this.getRequirementPhpVersion70Or71(), "PHP7071"));
 
         jobsMainStage.addAll(this.getJobsAcceptanceTestsMysql(this.numberOfAcceptanceTestJobs, this.getRequirementPhpVersion70Or71(), "PHP7071"));
 
@@ -163,4 +136,41 @@ public class PreMergeSpec extends AbstractCoreSpec {
             );
     }
 
+    /**
+     * Job creating labels needed for intercept communication
+     */
+    protected Job getJobBuildLabels() {
+        return new Job("Create build labels", new BambooKey("CLFB"))
+            .description("Create changeId and patch set labels from variable access and parsing result of a dummy task")
+            .tasks(
+                new ScriptTask()
+                    .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
+                    .inlineBody("echo \"I'm just here for the labels!\"")
+            );
+    }
+
+    /**
+     * Job checking CGL of last git commit
+     */
+    protected Job getJobCglCheckGitCommit() {
+        return new Job("Integration CGL", new BambooKey("CGLCHECK"))
+            .description("Check coding guidelines by executing Build/Scripts/cglFixMyCommit.sh script")
+            .tasks(
+                this.getTaskGitCloneRepository(),
+                this.getTaskGitCherryPick(),
+                this.getTaskComposerInstall(),
+                new ScriptTask()
+                    .description("Execute cgl check script")
+                    .interpreter(ScriptTaskProperties.Interpreter.BINSH_OR_CMDEXE)
+                    .inlineBody(
+                        this.getScriptTaskBashInlineBody() +
+                        "./Build/Scripts/cglFixMyCommit.sh dryrun\n"
+                    )
+            )
+            .requirements(
+                new Requirement("system.phpVersion")
+                    .matchValue("7\\.0|7\\.1")
+                    .matchType(Requirement.MatchType.MATCHES)
+            );
+    }
 }
diff --git a/typo3/sysext/core/Tests/AcceptanceInstallPgsql.suite.yml b/typo3/sysext/core/Tests/AcceptanceInstallPgsql.suite.yml
new file mode 100644 (file)
index 0000000..3e4ddd6
--- /dev/null
@@ -0,0 +1,24 @@
+class_name: AcceptanceTester
+modules:
+  enabled:
+    - WebDriver
+    - \Helper\Acceptance
+    - Asserts
+  config:
+    WebDriver:
+      url: http://localhost:8000/typo3temp/var/tests/acceptanceinstallpgsql
+      browser: chrome
+      port: 4444
+      window_size: 1280x1024
+      wait: 1
+      restart: true
+      capabilities:
+        # Disable the "scroll to element before clicking" behavior as this breaks tests
+        # where for example a fixed docbar is used. Selenium scrolls to the element before
+        # clicking it and then complains that it can't click the element because another elemnt
+        # is overlaying it.
+        # You have to ensure that the element is in the viewport by your own before clicking it!
+        # You can simply do that by scrolling to it.
+        elementScrollBehavior: 1
+        chromeOptions:
+          args: [no-sandbox,disable-infobars,disable-notifications,disable-gpu,disable-software-rasterizer]
diff --git a/typo3/sysext/core/Tests/AcceptanceInstallPgsql/InstallWithPgsqlCest.php b/typo3/sysext/core/Tests/AcceptanceInstallPgsql/InstallWithPgsqlCest.php
new file mode 100644 (file)
index 0000000..a72ae92
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\AcceptanceInstallPsql;
+
+/*
+ * 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!
+ */
+
+/**
+ * Click through installer, go to backend, install introduction package
+ */
+class InstallWithPgsqlCest
+{
+    /**
+     * @param \AcceptanceTester $I
+     */
+    public function installTypo3OnPgSql(\AcceptanceTester $I)
+    {
+        // Calling frontend redirects to installer
+        $I->amOnPage('/');
+
+        // EnvironmentAndFolders step
+        $I->waitForText('Installing TYPO3');
+        $I->see('System looks good. Continue!');
+        $I->click('System looks good. Continue!');
+
+        // DatabaseConnection step
+        $I->waitForText('Database connection');
+        $I->selectOption('#t3js-connect-database-driver', 'Manually configured PostgreSQL connection');
+        $I->fillField('#t3-install-step-postgresManualConfiguration-username', getenv('typo3DatabaseUsername'));
+        // password intentionally not filled. Postgres authenticates with the shell user.
+        $I->fillField('#t3-install-step-postgresManualConfiguration-database', getenv('typo3DatabaseName') . '_atipgsql');
+        $I->click('Continue');
+
+        // DatabaseData step
+        $I->waitForText('Create user and import base data');
+        $I->fillField('#username', 'admin');
+        $I->fillField('#password', 'password');
+        $I->click('Continue');
+
+        // DefaultConfiguration step - load distributions
+        $I->waitForText('Installation done!');
+        $I->click('#load-distributions');
+        $I->click('Open the TYPO3 Backend');
+
+        // Verify backend login successful
+        $I->waitForElement('#t3-username');
+        $I->fillField('#t3-username', 'admin');
+        $I->fillField('#t3-password', 'password');
+        $I->click('#t3-login-submit-section > button');
+        $I->waitForElement('.nav', 30);
+        $I->waitForElement('.scaffold-content iframe', 30);
+        $I->seeCookie('be_lastLoginProvider');
+        $I->seeCookie('be_typo_user');
+
+        // Loading might take some time
+        $I->switchToIFrame('list_frame');
+        $I->waitForText('Get preconfigured distribution', 30);
+        $I->click('.t3-button-action-installdistribution');
+        $I->waitForText('You successfully installed the distribution:introduction', 30);
+
+        // Verify default frontend is rendered
+        $I->amOnPage('/');
+        $I->waitForText('Make it your own');
+    }
+}