‪TYPO3CMS  9.5
BookmarkCest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 use Codeception\Scenario;
21 use TYPO3\TestingFramework\Core\Acceptance\Helper\Topbar;
22 
27 {
33  public static ‪$topBarModuleSelector = '#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem';
34 
40  protected static ‪$docHeaderBookmarkButtonSelector = '.module-docheader .btn[title="Create a bookmark to this page"]';
41 
45  public function ‪_before(‪BackendTester $I)
46  {
47  $I->useExistingSession('admin');
48  }
49 
55  {
57  $I->cantSeeElement(self::$topBarModuleSelector . ' .shortcut');
58  return $I;
59  }
60 
67  public function ‪checkThatAddingABookmarkAddsItemToTheBookmarkList(‪BackendTester $I, ‪ModalDialog $dialog, Scenario $scenario)
68  {
69  // open the scheduler module as we would like to put it into the bookmark liste
70  $I->click('Scheduler', '.scaffold-modulemenu');
71 
72  $I->switchToContentFrame();
73 
74  $I->click(self::$docHeaderBookmarkButtonSelector);
75  // cancel the action to test the functionality
76  // don't use $modalDialog->clickButtonInDialog due to too low timeout
77  $dialog->canSeeDialog();
78  $I->click('Cancel', ModalDialog::$openedModalButtonContainerSelector);
79  $I->waitForElementNotVisible(ModalDialog::$openedModalSelector, 30);
80 
81  // check if the list is still empty
83 
84  $I->switchToContentFrame();
85  $I->click(self::$docHeaderBookmarkButtonSelector);
86 
87  $dialog->clickButtonInDialog('OK');
88 
90  $I->waitForText('Scheduled tasks', 15, self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
91 
92  // @test complete test when https://forge.typo3.org/issues/75689 is fixed
93  $scenario->comment(
94  'Tests for deleting the item in the list and readding it are missing ' .
95  'as this is currently broken in the core. See https://forge.typo3.org/issues/75689'
96  );
97 
98  return $I;
99  }
100 
106  {
108  $I->click('Scheduled tasks', self::$topBarModuleSelector);
109  $I->switchToContentFrame();
110  $I->canSee('Scheduled tasks', 'h1');
111  }
112 
118  {
120  $firstShortcutSelector = self::$topBarModuleSelector . ' .t3js-topbar-shortcut';
121  $I->click('.t3js-shortcut-edit', $firstShortcutSelector);
122  $secondShortcutSelector = self::$topBarModuleSelector . ' form.shortcut-form';
123  $I->fillField($secondShortcutSelector . ' input[name="shortcut-title"]', 'Scheduled tasks renamed');
124  $I->click('.shortcut-form-save', $secondShortcutSelector);
125 
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');
130  }
131 
137  {
139 
140  $I->canSee('Scheduled tasks renamed', self::$topBarModuleSelector);
141  $I->click('.t3js-shortcut-delete', self::$topBarModuleSelector . ' .t3js-topbar-shortcut');
142  $dialog->clickButtonInDialog('OK');
143 
144  $I->cantSee('Scheduled tasks renamed', self::$topBarModuleSelector);
145  }
146 
151  {
152  $I->waitForElementVisible(self::$topBarModuleSelector . ' ' . Topbar::$dropdownToggleSelector);
153  $I->click(Topbar::$dropdownToggleSelector, self::$topBarModuleSelector);
154  }
155 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkIfEditBookmarkItemWorks
‪checkIfEditBookmarkItemWorks(BackendTester $I)
Definition: BookmarkCest.php:115
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\$docHeaderBookmarkButtonSelector
‪static string $docHeaderBookmarkButtonSelector
Definition: BookmarkCest.php:38
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest
Definition: BookmarkCest.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\_before
‪_before(BackendTester $I)
Definition: BookmarkCest.php:43
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkIfBookmarkItemLinksToTarget
‪checkIfBookmarkItemLinksToTarget(BackendTester $I)
Definition: BookmarkCest.php:103
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkThatBookmarkListIsInitiallyEmpty
‪BackendTester checkThatBookmarkListIsInitiallyEmpty(BackendTester $I)
Definition: BookmarkCest.php:52
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar
Definition: BookmarkCest.php:3
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\$topBarModuleSelector
‪static string $topBarModuleSelector
Definition: BookmarkCest.php:32
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\clickBookmarkDropdownToggleInTopbar
‪clickBookmarkDropdownToggleInTopbar(BackendTester $I)
Definition: BookmarkCest.php:148
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkThatAddingABookmarkAddsItemToTheBookmarkList
‪BackendTester checkThatAddingABookmarkAddsItemToTheBookmarkList(BackendTester $I, ModalDialog $dialog, Scenario $scenario)
Definition: BookmarkCest.php:65
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:25
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkIfDeleteBookmarkWorks
‪checkIfDeleteBookmarkWorks(BackendTester $I, ModalDialog $dialog)
Definition: BookmarkCest.php:134