2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar
;
5 * This file is part of the TYPO3 CMS project.
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
17 use Codeception\Scenario
;
18 use TYPO3\CMS\Core\Tests\Acceptance\Step\Backend\Admin
;
19 use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
;
20 use TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\Topbar
;
23 * Test for the "Bookmark" functionality
28 * Selector for the module container in the topbar
32 public static $topBarModuleSelector = '#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem';
35 * Selector for the "Add to bookmark" button
39 protected static $docHeaderBookmarkButtonSelector = '.module-docheader .btn[title="Create a bookmark to this page"]';
44 public function _before(Admin
$I)
46 $I->useExistingSession();
47 $I->switchToIFrame('content');
48 // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
49 $I->waitForText('Web>Page module');
56 public function checkThatBookmarkListIsInitiallyEmpty(Admin
$I)
58 $this->clickBookmarkDropdownToggleInTopbar($I);
59 $I->cantSeeElement(self
::$topBarModuleSelector . ' .shortcut');
64 * @depends checkThatBookmarkListIsInitiallyEmpty
66 * @param ModalDialog $dialog
69 public function checkThatAddingABookmarkAddAItemToTheBookmarkList(Admin
$I, ModalDialog
$dialog, Scenario
$scenario)
72 // open the scheduler module as we would like to put it into the bookmark liste
73 $I->click('Scheduler', '#typo3-module-menu');
75 $I->switchToIFrame('content');
77 $I->click(self
::$docHeaderBookmarkButtonSelector);
78 // cancel the action to test the functionality
79 $dialog->clickButtonInDialog('Cancel');
81 // check if the list is still empty
82 $this->checkThatBookmarkListIsInitiallyEmpty($I);
84 $I->switchToIFrame('content');
85 $I->click(self
::$docHeaderBookmarkButtonSelector);
87 $dialog->clickButtonInDialog('OK');
89 $this->clickBookmarkDropdownToggleInTopbar($I);
90 $I->canSee('Scheduled tasks', self
::$topBarModuleSelector . ' ' . Topbar
::$dropdownContainerSelector);
92 // @test complese test when https://forge.typo3.org/issues/75689 is fixed
94 'Test for deleting the item in the list and readd it are missing ' .
95 'as this is currently broken in the core. See https://forge.typo3.org/issues/75689'
103 * @depends checkThatAddingABookmarkAddAItemToTheBookmarkList
105 public function checkIfBookmarkItemLinksToTarget(Admin
$I)
107 $this->clickBookmarkDropdownToggleInTopbar($I);
108 $I->click('Scheduled tasks', self
::$topBarModuleSelector);
109 $I->switchToIFrame('content');
110 $I->canSee('Scheduled tasks', 'h1');
115 * @depends checkThatAddingABookmarkAddAItemToTheBookmarkList
117 public function checkIfEditBookmarkItemWorks(Admin
$I)
119 $this->clickBookmarkDropdownToggleInTopbar($I);
120 $firstShortcutSelector = self
::$topBarModuleSelector . ' .shortcut';
121 $I->click('.shortcut-edit', $firstShortcutSelector);
123 $I->fillField($firstShortcutSelector . ' input[name="shortcut-title"]', 'Scheduled tasks renamed');
124 $I->click('.shortcut-form-save', $firstShortcutSelector);
126 // searching in a specific context fails with an "Stale Element Reference Exception"
127 // see http://docs.seleniumhq.org/exceptions/stale_element_reference.jsp
128 // currently don't know how to fix that so we search in the whole context.
129 $I->waitForText('Scheduled tasks renamed');
134 * @depends checkThatAddingABookmarkAddAItemToTheBookmarkList
136 public function checkIfDeleteBookmarkWorks(Admin
$I, ModalDialog
$dialog)
138 $this->clickBookmarkDropdownToggleInTopbar($I);
140 $I->canSee('Scheduled tasks renamed', self
::$topBarModuleSelector);
141 $I->click('.shortcut-delete', self
::$topBarModuleSelector . ' .shortcut');
142 $dialog->clickButtonInDialog('OK');
144 $I->cantSee('Scheduled tasks renamed', self
::$topBarModuleSelector);
150 protected function clickBookmarkDropdownToggleInTopbar(Admin
$I)
152 $I->switchToIFrame();
153 $I->click(Topbar
::$dropdownToggleSelector, self
::$topBarModuleSelector);