‪TYPO3CMS  11.5
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 {
33  public static string ‪$topBarModuleSelector = '#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem';
34 
38  protected static string ‪$docHeaderBookmarkButtonSelector = '#dropdownShortcutMenu';
39 
40  public function ‪_before(‪ApplicationTester $I): void
41  {
42  $I->useExistingSession('admin');
43  }
44 
46  {
48  $I->cantSeeElement(self::$topBarModuleSelector . ' .shortcut');
49  }
50 
52  {
53  // open the scheduler module as we would like to put it into the bookmark list
54  $I->click('Scheduler', '.scaffold-modulemenu');
55 
56  $I->switchToContentFrame();
57 
58  $I->click(self::$docHeaderBookmarkButtonSelector);
59  $I->waitForElementVisible('.module-docheader .dropdown-menu');
60  $I->click('.module-docheader .dropdown-menu button:nth-of-type(1)');
61  // cancel the action to test the functionality
62  // don't use $modalDialog->clickButtonInDialog due to too low timeout
63  $dialog->‪canSeeDialog();
65  $I->waitForElementNotVisible(‪ModalDialog::$openedModalSelector, 30);
66 
67  // check if the list is still empty
69  $I->cantSeeElement(self::$topBarModuleSelector . ' .shortcut');
70 
71  $I->switchToContentFrame();
72  $I->click(self::$docHeaderBookmarkButtonSelector);
73  $I->waitForElementVisible('.module-docheader .dropdown-menu');
74  $I->click('.module-docheader .dropdown-menu button:nth-of-type(1)');
75 
76  $dialog->‪canSeeDialog();
77  $dialog->‪clickButtonInDialog('OK');
78 
80  $I->waitForText('Scheduled tasks', 15, self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
81 
82  // @test complete test when https://forge.typo3.org/issues/75689 is fixed
83  $scenario->comment(
84  'Tests for deleting the item in the list and re-adding it are missing ' .
85  'as this is currently broken in the core. See https://forge.typo3.org/issues/75689'
86  );
87 
88  return $I;
89  }
90 
95  {
97  $I->click('Scheduled tasks', self::$topBarModuleSelector);
98  $I->switchToContentFrame();
99  $I->canSee('Scheduled tasks', 'h1');
100  }
101 
106  {
108  $firstShortcutSelector = self::$topBarModuleSelector . ' .t3js-topbar-shortcut';
109  $I->click('.t3js-shortcut-edit', $firstShortcutSelector);
110  $secondShortcutSelector = self::$topBarModuleSelector . ' form.shortcut-form';
111  $I->waitForElementVisible($secondShortcutSelector . ' input[name="shortcut-title"]');
112  $I->fillField($secondShortcutSelector . ' input[name="shortcut-title"]', 'Scheduled tasks renamed');
113  $I->click('.shortcut-form-save', $secondShortcutSelector);
114 
115  // searching in a specific context fails with a "Stale Element Reference Exception"
116  // see http://docs.seleniumhq.org/exceptions/stale_element_reference.jsp
117  // currently don't know how to fix that so we search in the whole context.
118  $I->waitForText('Scheduled tasks renamed');
119  }
120 
125  {
127 
128  $I->canSee('Scheduled tasks renamed', self::$topBarModuleSelector);
129  $I->click('.t3js-shortcut-delete', self::$topBarModuleSelector . ' .t3js-topbar-shortcut');
130  $dialog->‪clickButtonInDialog('OK');
131  $I->waitForElementNotVisible('Scheduled tasks renamed');
132  $I->cantSee('Scheduled tasks renamed', self::$topBarModuleSelector);
133  }
134 
136  {
137  $I->waitForElementVisible(self::$topBarModuleSelector . ' ' . Topbar::$dropdownToggleSelector);
138  $I->click(Topbar::$dropdownToggleSelector, self::$topBarModuleSelector);
139  }
140 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalSelector
‪static string $openedModalSelector
Definition: ModalDialog.php:33
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\clickBookmarkDropdownToggleInTopbar
‪clickBookmarkDropdownToggleInTopbar(ApplicationTester $I)
Definition: BookmarkCest.php:135
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\$openedModalButtonContainerSelector
‪static string $openedModalButtonContainerSelector
Definition: ModalDialog.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\checkIfDeleteBookmarkWorks
‪checkIfDeleteBookmarkWorks(ApplicationTester $I, ModalDialog $dialog)
Definition: BookmarkCest.php:124
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\checkIfEditBookmarkItemWorks
‪checkIfEditBookmarkItemWorks(ApplicationTester $I)
Definition: BookmarkCest.php:105
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar
Definition: BookmarkCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\$topBarModuleSelector
‪static string $topBarModuleSelector
Definition: BookmarkCest.php:33
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest
Definition: BookmarkCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\checkIfBookmarkItemLinksToTarget
‪checkIfBookmarkItemLinksToTarget(ApplicationTester $I)
Definition: BookmarkCest.php:94
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\canSeeDialog
‪canSeeDialog()
Definition: ModalDialog.php:73
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog\clickButtonInDialog
‪clickButtonInDialog(string $buttonLinkLocator)
Definition: ModalDialog.php:62
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\checkThatAddingABookmarkAddsItemToTheBookmarkList
‪checkThatAddingABookmarkAddsItemToTheBookmarkList(ApplicationTester $I, ModalDialog $dialog, Scenario $scenario)
Definition: BookmarkCest.php:51
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\_before
‪_before(ApplicationTester $I)
Definition: BookmarkCest.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\$docHeaderBookmarkButtonSelector
‪static string $docHeaderBookmarkButtonSelector
Definition: BookmarkCest.php:38
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\ModalDialog
Definition: ModalDialog.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\Topbar\BookmarkCest\checkThatBookmarkListIsInitiallyEmpty
‪checkThatBookmarkListIsInitiallyEmpty(ApplicationTester $I)
Definition: BookmarkCest.php:45