From 3ab57e18192f3a6107797c4af6b86077c87593e8 Mon Sep 17 00:00:00 2001 From: Sascha Egerer <sascha@sascha-egerer.de> Date: Thu, 14 Apr 2016 21:01:54 +0200 Subject: [PATCH] [TASK] Add more acceptance tests for main module menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test class for main menu tests has been refactored and a additional test has been added to ensure a menu point gets active if it is clicked. Change-Id: Ib829a2e2cbcdaf34b1e36687630f9d94e9a03879 Resolves: #75629 Releases: master Reviewed-on: https://review.typo3.org/47676 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> --- .../Backend/General/ModuleMenuCest.php | 66 +++++++++++++++++ .../Backend/Menu/ModuleMenuSliderCest.php | 73 ------------------- 2 files changed, 66 insertions(+), 73 deletions(-) create mode 100644 typo3/sysext/core/Tests/Acceptance/Backend/General/ModuleMenuCest.php delete mode 100644 typo3/sysext/core/Tests/Acceptance/Backend/Menu/ModuleMenuSliderCest.php diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/General/ModuleMenuCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/General/ModuleMenuCest.php new file mode 100644 index 000000000000..ab6d3a2f184f --- /dev/null +++ b/typo3/sysext/core/Tests/Acceptance/Backend/General/ModuleMenuCest.php @@ -0,0 +1,66 @@ +<?php +namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\General; + +/* + * 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; + +/** + * Module Menu tests + */ +class ModuleMenuCest +{ + /** + * @param Admin $I + */ + public function _before(Admin $I) + { + $I->useExistingSession(); + } + + /** + * @param Admin $I + */ + public function checkIfModuleMenuIsCollapsible(Admin $I) + { + foreach (['#web', '#system'] as $moduleGroupId) { + $I->seeElement($moduleGroupId . ' .typo3-module-menu-group-container .typo3-module-menu-item'); + + $I->wantTo('collapse the menu element'); + $I->click($moduleGroupId . ' .typo3-module-menu-group-header'); + + $I->waitForElementNotVisible($moduleGroupId . ' .typo3-module-menu-group-container .typo3-module-menu-item'); + + $I->wantTo('expand the menu element again'); + $I->click($moduleGroupId . ' .typo3-module-menu-group-header'); + + $I->seeElement($moduleGroupId . ' .typo3-module-menu-group-container .typo3-module-menu-item'); + } + } + + /** + * @param Admin $I + */ + public function selectingAModuleDoesHighlightIt(Admin $I) + { + $I->seeNumberOfElements('#web .typo3-module-menu-item-link', [2,20]); + + $I->wantTo('check that the second element has no "active" class\''); + $I->cantSeeElement('#web #web_list.active'); + $I->click('#web #web_list .typo3-module-menu-item-link'); + + $I->wantTo('see that the second element has an "active" class'); + $I->canSeeElement('#web #web_list.active'); + } +} diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Menu/ModuleMenuSliderCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Menu/ModuleMenuSliderCest.php deleted file mode 100644 index 2c11d1e7852b..000000000000 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Menu/ModuleMenuSliderCest.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php -namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Menu; - -/* - * 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\Kasper; - -/** - * Acceptance test - */ -class ModuleMenuSliderCest -{ - public function _before(Kasper $I) - { - $I->loginAsAdmin(); - } - - public function _after(Kasper $I) - { - $I->logout(); - } - - // tests - public function tryToTest(Kasper $I) - { - $ids = ['#web', '#tools', '#system']; - $sees = ['Page', 'Extensions']; - - $menuItems = [ - ['mainId' => '#web', 'menuItem' => 'Page'], - ['mainId' => '#tools', 'menuItem' => 'Extensions'], - ['mainId' => '#system', 'menuItem' => 'Log'] - ]; - - $I->wantTo('check the slider in the module menu'); - - foreach ($menuItems as $menuItem) { - $id = $menuItem['mainId']; - $menuItem = $menuItem['menuItem']; - - $I->waitForElement($id); - - // close the item - $classString = $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) use ($id) { - return $webdriver->findElement(\WebDriverBy::cssSelector($id))->getAttribute('class'); - }); - - if (strpos($classString, 'expanded') !== false) { - $I->click($id . ' > div'); - $I->wait(2); // the animation is so fast - } - - $I->dontSee($menuItem); - - // now we expand it - $I->click($id . ' > div'); - - // and wait a short moment - $I->waitForText($menuItem); - } - } -} -- GitLab