From a746575b2814cdf41a756695341068be7ce7ab4e Mon Sep 17 00:00:00 2001 From: Dirk Juettner Date: Fri, 15 Apr 2016 20:51:55 +0200 Subject: [PATCH] [TASK] Check if clear cache module is not visible for editor MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add an acceptance test to ensure that the clear cache menu in the topbar is not visible for non admin users. Also check if the Bookmark section is visible. Resolves: #75701 Releases: master Change-Id: Ia1f23c869e6e21c95cc5b4024fa6f0209ca25df9 Reviewed-on: https://review.typo3.org/47722 Reviewed-by: Sascha Egerer Tested-by: Sascha Egerer Reviewed-by: Dirk Jüttner Tested-by: Dirk Jüttner Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- .../Acceptance/Backend/Login/EditorCest.php | 19 +++++--- .../{FavoriteCest.php => BookmarkCest.php} | 46 +++++++++---------- .../Acceptance/Support/Helper/Topbar.php | 7 +++ 3 files changed, 43 insertions(+), 29 deletions(-) rename typo3/sysext/core/Tests/Acceptance/Backend/Topbar/{FavoriteCest.php => BookmarkCest.php} (74%) diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php index 54b36c90c859..d5920aa92228 100644 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php +++ b/typo3/sysext/core/Tests/Acceptance/Backend/Login/EditorCest.php @@ -15,25 +15,32 @@ namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Login; */ use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Kasper; +use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Topbar; /** - * Acceptance test + * Editor login tests */ class EditorCest { - /** - * Login a non-admin user and logout again + * Login as a non-admin user, check visible modules and logout again * * @param Kasper $I */ - public function tryToTest(Kasper $I) + public function loginAsEditor(Kasper $I) { - $I->wantTo('login with editor'); $I->loginAsEditor(); // user is redirected to 'about modules' after login, but must not see the 'admin tools' section - $I->cantSee('Admin tools'); + $I->cantSee('Admin tools', '#typo3-menu'); + + $topBarItemSelector = Topbar::$containerSelector . ' ' . Topbar::$dropdownToggleSelector . ' *'; + + // can see bookmarks + $I->seeElement($topBarItemSelector, ['title' => 'Bookmarks']); + + // cant see clear cache + $I->cantSeeElement($topBarItemSelector, ['title' => 'Clear cache']); $I->logout(); $I->waitForElement('#t3-username'); diff --git a/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/FavoriteCest.php b/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/BookmarkCest.php similarity index 74% rename from typo3/sysext/core/Tests/Acceptance/Backend/Topbar/FavoriteCest.php rename to typo3/sysext/core/Tests/Acceptance/Backend/Topbar/BookmarkCest.php index 30b733c4f68b..34fb0c9958ad 100644 --- a/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/FavoriteCest.php +++ b/typo3/sysext/core/Tests/Acceptance/Backend/Topbar/BookmarkCest.php @@ -20,9 +20,9 @@ use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog; use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Topbar; /** - * Test for the "Favorite" functionality + * Test for the "Bookmark" functionality */ -class FavoriteCest +class BookmarkCest { /** * Selector for the module container in the topbar @@ -32,11 +32,11 @@ class FavoriteCest public static $topBarModuleSelector = '#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem'; /** - * Selector for the "Add to favorite" button + * Selector for the "Add to bookmark" button * * @var string */ - protected static $docHeaderFavoriteButtonSelector = '.module-docheader .btn[title="Create a bookmark to this page"]'; + protected static $docHeaderBookmarkButtonSelector = '.module-docheader .btn[title="Create a bookmark to this page"]'; /** * @param Admin $I @@ -53,40 +53,40 @@ class FavoriteCest * @param Admin $I * @return Admin */ - public function checkThatFavoriteListIsInitiallyEmpty(Admin $I) + public function checkThatBookmarkListIsInitiallyEmpty(Admin $I) { - $this->clickFavoriteDropdownToggleInTopbar($I); + $this->clickBookmarkDropdownToggleInTopbar($I); $I->cantSeeElement(self::$topBarModuleSelector . ' .shortcut'); return $I; } /** - * @depends checkThatFavoriteListIsInitiallyEmpty + * @depends checkThatBookmarkListIsInitiallyEmpty * @param Admin $I * @param ModalDialog $dialog * @return Admin */ - public function checkThatAddingAFavoriteAddAItemToTheFavoriteList(Admin $I, ModalDialog $dialog, Scenario $scenario) + public function checkThatAddingABookmarkAddAItemToTheBookmarkList(Admin $I, ModalDialog $dialog, Scenario $scenario) { $I->switchToIFrame(); - // open the scheduler module as we would like to put it into the favorite liste + // open the scheduler module as we would like to put it into the bookmark liste $I->click('Scheduler', '#typo3-module-menu'); $I->switchToIFrame('content'); - $I->click(self::$docHeaderFavoriteButtonSelector); + $I->click(self::$docHeaderBookmarkButtonSelector); // cancel the action to test the functionality $dialog->clickButtonInDialog('Cancel'); // check if the list is still empty - $this->checkThatFavoriteListIsInitiallyEmpty($I); + $this->checkThatBookmarkListIsInitiallyEmpty($I); $I->switchToIFrame('content'); - $I->click(self::$docHeaderFavoriteButtonSelector); + $I->click(self::$docHeaderBookmarkButtonSelector); $dialog->clickButtonInDialog('OK'); - $this->clickFavoriteDropdownToggleInTopbar($I); + $this->clickBookmarkDropdownToggleInTopbar($I); $I->canSee('Scheduled tasks', self::$topBarModuleSelector . ' ' . Topbar::$dropdownContainerSelector); // @test complese test when https://forge.typo3.org/issues/75689 is fixed @@ -100,11 +100,11 @@ class FavoriteCest /** * @param Admin $I - * @depends checkThatAddingAFavoriteAddAItemToTheFavoriteList + * @depends checkThatAddingABookmarkAddAItemToTheBookmarkList */ - public function checkIfFavoriteItemLinksToTarget(Admin $I) + public function checkIfBookmarkItemLinksToTarget(Admin $I) { - $this->clickFavoriteDropdownToggleInTopbar($I); + $this->clickBookmarkDropdownToggleInTopbar($I); $I->click('Scheduled tasks', self::$topBarModuleSelector); $I->switchToIFrame('content'); $I->canSee('Scheduled tasks', 'h1'); @@ -112,11 +112,11 @@ class FavoriteCest /** * @param Admin $I - * @depends checkThatAddingAFavoriteAddAItemToTheFavoriteList + * @depends checkThatAddingABookmarkAddAItemToTheBookmarkList */ - public function checkIfEditFavoriteItemWorks(Admin $I) + public function checkIfEditBookmarkItemWorks(Admin $I) { - $this->clickFavoriteDropdownToggleInTopbar($I); + $this->clickBookmarkDropdownToggleInTopbar($I); $firstShortcutSelector = self::$topBarModuleSelector . ' .shortcut'; $I->click('.shortcut-edit', $firstShortcutSelector); @@ -131,11 +131,11 @@ class FavoriteCest /** * @param Admin $I - * @depends checkThatAddingAFavoriteAddAItemToTheFavoriteList + * @depends checkThatAddingABookmarkAddAItemToTheBookmarkList */ - public function checkIfDeleteFavoriteWorks(Admin $I, ModalDialog $dialog) + public function checkIfDeleteBookmarkWorks(Admin $I, ModalDialog $dialog) { - $this->clickFavoriteDropdownToggleInTopbar($I); + $this->clickBookmarkDropdownToggleInTopbar($I); $I->canSee('Scheduled tasks renamed', self::$topBarModuleSelector); $I->click('.shortcut-delete', self::$topBarModuleSelector . ' .shortcut'); @@ -147,7 +147,7 @@ class FavoriteCest /** * @param Admin $I */ - protected function clickFavoriteDropdownToggleInTopbar(Admin $I) + protected function clickBookmarkDropdownToggleInTopbar(Admin $I) { $I->switchToIFrame(); $I->click(Topbar::$dropdownToggleSelector, self::$topBarModuleSelector); diff --git a/typo3/sysext/core/Tests/Acceptance/Support/Helper/Topbar.php b/typo3/sysext/core/Tests/Acceptance/Support/Helper/Topbar.php index e3af47174a78..4a38aa1c8167 100644 --- a/typo3/sysext/core/Tests/Acceptance/Support/Helper/Topbar.php +++ b/typo3/sysext/core/Tests/Acceptance/Support/Helper/Topbar.php @@ -19,6 +19,13 @@ namespace TYPO3\CMS\Core\Tests\Acceptance\Support\Helper; */ class Topbar { + /** + * Selector for the topbar container + * + * @var string + */ + public static $containerSelector = '#typo3-top-container'; + /** * Selector for the dropdown container * -- 2.20.1