‪TYPO3CMS  10.4
SelectPagetreeWithKeyboardCest.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 ‪Exception;
21 use Facebook\WebDriver\WebDriverKeys;
24 
29 {
37  public function ‪_before(‪BackendTester $I, ‪PageTree $pageTree)
38  {
39  $I->useExistingSession('admin');
40  $I->click('List');
41  $pageTree->openPath(['Root']);
42  $I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
43  $I->waitForElement('#identifier-0_1[tabindex="0"]', 5);
44  }
45 
52  {
53  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
54  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
55  $I->assertEquals(
56  'Dummy 1-2',
57  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
58  );
59  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::ENTER);
60  $I->switchToContentFrame();
61  $I->see('Dummy 1-2');
62  }
63 
70  {
71  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
72  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
73  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
74  $I->assertEquals(
75  'Dummy 1-3',
76  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
77  );
78  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::UP);
79  $I->assertEquals(
80  'Dummy 1-2',
81  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
82  );
83  }
84 
91  {
92  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
93  $I->amGoingTo('use keyboard to navigate through the tree');
94  for ($times = 0; $times < 3; $times++) {
95  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
96  }
97  $I->amGoingTo('check if the parent key is selected and child is not visible');
98  $I->assertEquals(
99  'Dummy 1-4',
100  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
101  );
102  $I->amGoingTo('check if parent is still selected and child is visible');
103  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::RIGHT);
104  $I->assertEquals(
105  'Dummy 1-4',
106  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
107  );
108  $I->see('Dummy 1-4-5');
109  $I->amGoingTo('check if first child node is selected');
110  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::RIGHT);
111  $I->assertEquals(
112  'Dummy 1-4-5',
113  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
114  );
115  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::RIGHT);
116  $I->amGoingTo('check if first child node is still selected');
117  $I->assertEquals(
118  'Dummy 1-4-5',
119  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
120  );
121  $I->amGoingTo('check if second child node is selected');
122  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
123  $I->assertEquals(
124  'Dummy 6',
125  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
126  );
127  }
128 
135  {
136  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
137  $I->assertEquals(
138  'Root',
139  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
140  );
141  $I->see('Dummy 1-2');
142  $I->amGoingTo('collapse the current tree using left key');
143  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::LEFT);
144  $I->assertEquals(
145  'Root',
146  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
147  );
148  $I->cantSee('Dummy 1-2');
149  $I->amGoingTo('go to parent of the current collapsed node using left key');
150  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::LEFT);
151  $I->amGoingTo('check if parent (root) is selected and child is visible');
152  $I->assertEquals(
153  'New TYPO3 site',
154  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
155  );
156  $I->canSee('Root');
157  $I->canSee('styleguide TCA demo');
158  }
159 
166  {
167  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
168  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::END);
169  $I->assertEquals(
170  'styleguide TCA demo',
171  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
172  );
173  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::UP);
174  $I->assertEquals(
175  'Dummy 1-50',
176  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
177  );
178  }
179 
186  {
187  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
188  for ($times = 0; $times < 15; $times++) {
189  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
190  }
191  $I->assertEquals(
192  'Dummy 1-21',
193  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
194  );
195 
196  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::HOME);
197  $I->assertEquals(
198  'New TYPO3 site',
199  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
200  );
201  }
202 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\_before
‪_before(BackendTester $I, PageTree $pageTree)
Definition: SelectPagetreeWithKeyboardCest.php:37
‪TYPO3\CMS\Core\Exception
Definition: Exception.php:22
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\focusPageWithDownAndUpKey
‪focusPageWithDownAndUpKey(BackendTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:69
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess
Definition: SelectPagetreeWithKeyboardCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\expandSubtreeWithRightArrow
‪expandSubtreeWithRightArrow(BackendTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:90
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\focusLastPageTreeItemWithEndKey
‪focusLastPageTreeItemWithEndKey(BackendTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:165
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest
Definition: SelectPagetreeWithKeyboardCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\collapseSubtreeWithLeftArrow
‪collapseSubtreeWithLeftArrow(BackendTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:134
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\focusPageWithDownKeyAndOpenItWithEnter
‪focusPageWithDownKeyAndOpenItWithEnter(BackendTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:51
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\focusFirstPageTreeItemWithHomeKey
‪focusFirstPageTreeItemWithHomeKey(BackendTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:185