‪TYPO3CMS  10.4
BookmarkCest.php
Go to the documentation of this file.
1 <?php
2 
3 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 
19 
20 use Codeception\Scenario;
23 use TYPO3\TestingFramework\Core\Acceptance\Helper\Topbar;
24 
29 {
35  public static ‪$topBarModuleSelector = '#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem';
36 
42  protected static ‪$docHeaderBookmarkButtonSelector = '.module-docheader .btn[title="Create a bookmark to this page"]';
43 
47  public function ‪_before(‪BackendTester $I)
48  {
49  $I->useExistingSession('admin');
50  }
51 
57  {
59  $I->cantSeeElement(self::$topBarModuleSelector . ' .shortcut');
60  return $I;
61  }
62 
69  public function ‪checkThatAddingABookmarkAddsItemToTheBookmarkList(‪BackendTester $I, ‪ModalDialog $dialog, Scenario $scenario)
70  {
71  // open the scheduler module as we would like to put it into the bookmark list
72  $I->click('Scheduler', '.scaffold-modulemenu');
73 
74  $I->switchToContentFrame();
75 
76  $I->click(self::$docHeaderBookmarkButtonSelector);
77  // cancel the action to test the functionality
78  // don't use $modalDialog->clickButtonInDialog due to too low timeout
79  $dialog->canSeeDialog();
80  $I->click('Cancel', ModalDialog::$openedModalButtonContainerSelector);
81  $I->waitForElementNotVisible(ModalDialog::$openedModalSelector, 30);
82 
83  // check if the list is still empty
85 
86  $I->switchToContentFrame();
87  $I->click(self::$docHeaderBookmarkButtonSelector);
88 
89  $dialog->clickButtonInDialog('OK');
90 
92  $I->waitForText('Scheduled tasks', 15, self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
93 
94  // @test complete test when https://forge.typo3.org/issues/75689 is fixed
95  $scenario->comment(
96  'Tests for deleting the item in the list and re-adding it are missing ' .
97  'as this is currently broken in the core. See https://forge.typo3.org/issues/75689'
98  );
99 
100  return $I;
101  }
102 
108  {
110  $I->click('Scheduled tasks', self::$topBarModuleSelector);
111  $I->switchToContentFrame();
112  $I->canSee('Scheduled tasks', 'h1');
113  }
114 
120  {
122  $firstShortcutSelector = self::$topBarModuleSelector . ' .t3js-topbar-shortcut';
123  $I->click('.t3js-shortcut-edit', $firstShortcutSelector);
124  $secondShortcutSelector = self::$topBarModuleSelector . ' form.shortcut-form';
125  $I->fillField($secondShortcutSelector . ' input[name="shortcut-title"]', 'Scheduled tasks renamed');
126  $I->click('.shortcut-form-save', $secondShortcutSelector);
127 
128  // searching in a specific context fails with an "Stale Element Reference Exception"
129  // see http://docs.seleniumhq.org/exceptions/stale_element_reference.jsp
130  // currently don't know how to fix that so we search in the whole context.
131  $I->waitForText('Scheduled tasks renamed');
132  }
133 
139  {
141 
142  $I->canSee('Scheduled tasks renamed', self::$topBarModuleSelector);
143  $I->click('.t3js-shortcut-delete', self::$topBarModuleSelector . ' .t3js-topbar-shortcut');
144  $dialog->clickButtonInDialog('OK');
145 
146  $I->cantSee('Scheduled tasks renamed', self::$topBarModuleSelector);
147  }
148 
153  {
154  $I->waitForElementVisible(self::$topBarModuleSelector . ' ' . Topbar::$dropdownToggleSelector);
155  $I->click(Topbar::$dropdownToggleSelector, self::$topBarModuleSelector);
156  }
157 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkIfEditBookmarkItemWorks
‪checkIfEditBookmarkItemWorks(BackendTester $I)
Definition: BookmarkCest.php:117
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\$docHeaderBookmarkButtonSelector
‪static string $docHeaderBookmarkButtonSelector
Definition: BookmarkCest.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest
Definition: BookmarkCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\_before
‪_before(BackendTester $I)
Definition: BookmarkCest.php:45
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkIfBookmarkItemLinksToTarget
‪checkIfBookmarkItemLinksToTarget(BackendTester $I)
Definition: BookmarkCest.php:105
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkThatBookmarkListIsInitiallyEmpty
‪BackendTester checkThatBookmarkListIsInitiallyEmpty(BackendTester $I)
Definition: BookmarkCest.php:54
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar
Definition: BookmarkCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\$topBarModuleSelector
‪static string $topBarModuleSelector
Definition: BookmarkCest.php:34
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\clickBookmarkDropdownToggleInTopbar
‪clickBookmarkDropdownToggleInTopbar(BackendTester $I)
Definition: BookmarkCest.php:150
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkThatAddingABookmarkAddsItemToTheBookmarkList
‪BackendTester checkThatAddingABookmarkAddsItemToTheBookmarkList(BackendTester $I, ModalDialog $dialog, Scenario $scenario)
Definition: BookmarkCest.php:67
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar\BookmarkCest\checkIfDeleteBookmarkWorks
‪checkIfDeleteBookmarkWorks(BackendTester $I, ModalDialog $dialog)
Definition: BookmarkCest.php:136