TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
BookmarkCest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Acceptance\Backend\Topbar;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
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.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use Codeception\Scenario;
21 
26 {
32  public static $topBarModuleSelector = '#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem';
33 
39  protected static $docHeaderBookmarkButtonSelector = '.module-docheader .btn[title="Create a bookmark to this page"]';
40 
44  public function _before(Admin $I)
45  {
46  $I->useExistingSession();
47  // Ensure main content frame is fully loaded, otherwise there are load-race-conditions
48  $I->switchToIFrame('list_frame');
49  $I->waitForText('Web Content Management System');
50  $I->switchToIFrame();
51  }
52 
58  {
60  $I->cantSeeElement(self::$topBarModuleSelector . ' .shortcut');
61  return $I;
62  }
63 
70  public function checkThatAddingABookmarkAddsItemToTheBookmarkList(Admin $I, ModalDialog $dialog, Scenario $scenario)
71  {
72  $I->switchToIFrame();
73  // open the scheduler module as we would like to put it into the bookmark liste
74  $I->click('Scheduler', '.scaffold-modulemenu');
75 
76  $I->switchToIFrame('list_frame');
77 
78  $I->click(self::$docHeaderBookmarkButtonSelector);
79  // cancel the action to test the functionality
80  $dialog->clickButtonInDialog('Cancel');
81 
82  // check if the list is still empty
84 
85  $I->switchToIFrame('list_frame');
86  $I->click(self::$docHeaderBookmarkButtonSelector);
87 
88  $dialog->clickButtonInDialog('OK');
89 
91  $I->waitForText('Scheduled tasks', 15, self::$topBarModuleSelector . ' ' . Topbar::$dropdownListSelector);
92 
93  // @test complete test when https://forge.typo3.org/issues/75689 is fixed
94  $scenario->comment(
95  'Tests for deleting the item in the list and readding it are missing ' .
96  'as this is currently broken in the core. See https://forge.typo3.org/issues/75689'
97  );
98 
99  return $I;
100  }
101 
107  {
109  $I->click('Scheduled tasks', self::$topBarModuleSelector);
110  $I->switchToIFrame('list_frame');
111  $I->canSee('Scheduled tasks', 'h1');
112  }
113 
119  {
121  $firstShortcutSelector = self::$topBarModuleSelector . ' .t3js-topbar-shortcut';
122  $I->click('.t3js-shortcut-edit', $firstShortcutSelector);
123  $secondShortcutSelector = self::$topBarModuleSelector . ' form.shortcut-form';
124  $I->fillField($secondShortcutSelector . ' input[name="shortcut-title"]', 'Scheduled tasks renamed');
125  $I->click('.shortcut-form-save', $secondShortcutSelector);
126 
127  // searching in a specific context fails with an "Stale Element Reference Exception"
128  // see http://docs.seleniumhq.org/exceptions/stale_element_reference.jsp
129  // currently don't know how to fix that so we search in the whole context.
130  $I->waitForText('Scheduled tasks renamed');
131  }
132 
137  public function checkIfDeleteBookmarkWorks(Admin $I, ModalDialog $dialog)
138  {
140 
141  $I->canSee('Scheduled tasks renamed', self::$topBarModuleSelector);
142  $I->click('.t3js-shortcut-delete', self::$topBarModuleSelector . ' .t3js-topbar-shortcut');
143  $dialog->clickButtonInDialog('OK');
144 
145  $I->cantSee('Scheduled tasks renamed', self::$topBarModuleSelector);
146  }
147 
152  {
153  $I->click(Topbar::$dropdownToggleSelector, self::$topBarModuleSelector);
154  }
155 }
checkThatAddingABookmarkAddsItemToTheBookmarkList(Admin $I, ModalDialog $dialog, Scenario $scenario)