From bab7087d6806c2236a4e919096e6e1321a14ced4 Mon Sep 17 00:00:00 2001
From: dirk_juettner <dirk.juettner@gmail.com>
Date: Thu, 14 Apr 2016 18:09:40 +0200
Subject: [PATCH] [TASK] Add more acceptance tests for topbar modules
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Resolves: #75631
Releases: master
Change-Id: I4f0bf756a2ddac9defb97749e66d74ffca636af8
Reviewed-on: https://review.typo3.org/47716
Reviewed-by: Dirk Jüttner <dirk.juettner@gmail.com>
Tested-by: Dirk Jüttner <dirk.juettner@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Acceptance/Backend/Topbar/HelpCest.php    | 67 +++++++++++++++++++
 .../Acceptance/Backend/Topbar/LogoCest.php    | 39 +++++++++++
 2 files changed, 106 insertions(+)
 create mode 100644 typo3/sysext/core/Tests/Acceptance/Backend/Topbar/HelpCest.php
 create mode 100644 typo3/sysext/core/Tests/Acceptance/Backend/Topbar/LogoCest.php

diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/HelpCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/HelpCest.php
new file mode 100644
index 000000000000..7fc4fde60310
--- /dev/null
+++ b/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/HelpCest.php
@@ -0,0 +1,67 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar;
+
+/*
+ * 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\CMS\Core\Tests\Acceptance\Step\Backend\Admin;
+use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Topbar;
+
+/**
+ * Tests for the help module in the topbar
+ */
+class HelpCest
+{
+    /**
+    * Selector for the module container in the topbar
+    *
+    * @var string
+    */
+    public static $topBarModuleSelector = '#typo3-cms-backend-backend-toolbaritems-helptoolbaritem';
+
+    /**
+     * @param Admin $I
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+        $I->switchToIFrame('content');
+        // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
+        $I->waitForText('Web>Page module');
+        $I->switchToIFrame();
+    }
+
+    /**
+     * @param Admin $I
+     * @return Admin
+     */
+    public function canSeeModuleInTopbar(Admin $I)
+    {
+        $I->canSeeElement(self::$topBarModuleSelector);
+
+        return $I;
+    }
+
+    /**
+     * @depends canSeeModuleInTopbar
+     * @param Admin $I
+     */
+    public function seeStyleguideInHelpModule(Admin $I)
+    {
+        $I->click(Topbar::$dropdownToggleSelector, self::$topBarModuleSelector);
+        $I->canSee('Styleguide', self::$topBarModuleSelector);
+        $I->click('Styleguide', self::$topBarModuleSelector);
+        $I->switchToIFrame('content');
+        $I->see('TYPO3 CMS Backend Styleguide', 'h1');
+    }
+}
diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/LogoCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/LogoCest.php
new file mode 100644
index 000000000000..6655d25ff63e
--- /dev/null
+++ b/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/LogoCest.php
@@ -0,0 +1,39 @@
+<?php
+namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar;
+
+/*
+ * 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\CMS\Core\Tests\Acceptance\Step\Backend\Admin;
+
+/**
+ * Acceptance test for the TYPO3 logo in the topbar
+ */
+class LogoCest
+{
+    /**
+     * @param Admin $I
+     */
+    public function _before(Admin $I)
+    {
+        $I->useExistingSession();
+    }
+
+    /**
+     * @param Admin $I
+     */
+    public function checkIfTypo3LogoIsLinked(Admin $I)
+    {
+        $I->seeElement('#typo3-topbar .typo3-topbar-site-logo', ['href' => 'https://typo3.org/']);
+    }
+}
-- 
GitLab