‪TYPO3CMS  11.5
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 {
35  public function ‪_before(‪ApplicationTester $I, ‪PageTree $pageTree): void
36  {
37  $I->useExistingSession('admin');
38  $I->click('List');
39  $I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
40  $pageTree->‪openPath(['Root']);
41  $I->waitForElement('#typo3-pagetree-tree .nodes .node', 5);
42  $I->waitForElement('#identifier-0_1[tabindex="0"]', 5);
43  }
44 
49  {
50  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
51  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
52  $I->assertEquals(
53  'Dummy 1-2',
54  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
55  );
56  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::ENTER);
57  $I->switchToContentFrame();
58  $I->see('Dummy 1-2');
59  }
60 
65  {
66  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
67  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
68  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
69  $I->assertEquals(
70  'Dummy 1-3',
71  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
72  );
73  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::UP);
74  $I->assertEquals(
75  'Dummy 1-2',
76  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
77  );
78  }
79 
84  {
85  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
86  $I->amGoingTo('use keyboard to navigate through the tree');
87  for ($times = 0; $times < 3; $times++) {
88  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
89  }
90  $I->amGoingTo('check if the parent key is selected and child is not visible');
91  $I->assertEquals(
92  'Dummy 1-4',
93  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
94  );
95  $I->amGoingTo('check if parent is still selected and child is visible');
96  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::RIGHT);
97  $I->assertEquals(
98  'Dummy 1-4',
99  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
100  );
101  $I->see('Dummy 1-4-5');
102  $I->amGoingTo('check if first child node is selected');
103  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::RIGHT);
104  $I->assertEquals(
105  'Dummy 1-4-5',
106  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
107  );
108  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::RIGHT);
109  $I->amGoingTo('check if first child node is still selected');
110  $I->assertEquals(
111  'Dummy 1-4-5',
112  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
113  );
114  $I->amGoingTo('check if second child node is selected');
115  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
116  $I->assertEquals(
117  'Dummy 6',
118  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
119  );
120  }
121 
126  {
127  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
128  $I->assertEquals(
129  'Root',
130  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
131  );
132  $I->see('Dummy 1-2');
133  $I->amGoingTo('collapse the current tree using left key');
134  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::LEFT);
135  $I->assertEquals(
136  'Root',
137  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
138  );
139  $I->cantSee('Dummy 1-2');
140  $I->amGoingTo('go to parent of the current collapsed node using left key');
141  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::LEFT);
142  $I->amGoingTo('check if parent (root) is selected and child is visible');
143  $I->assertEquals(
144  'New TYPO3 site',
145  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
146  );
147  $I->canSee('Root');
148  $I->canSee('styleguide TCA demo');
149  }
150 
155  {
156  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
157  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::END);
158  $I->assertEquals(
159  'styleguide frontend demo',
160  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
161  );
162  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::UP);
163  $I->assertEquals(
164  'styleguide TCA demo',
165  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
166  );
167  }
168 
173  {
174  $pageTree->‪openPath(['Root']);
175  $I->wait(2);
176  $I->seeElement('#typo3-pagetree-tree [tabindex="0"]');
177  for ($times = 0; $times < 15; $times++) {
178  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::DOWN);
179  }
180  $I->assertEquals(
181  'Dummy 1-21',
182  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
183  );
184 
185  $I->pressKey('#typo3-pagetree-tree [tabindex="0"]', WebDriverKeys::HOME);
186  $I->assertEquals(
187  'New TYPO3 site',
188  $I->grabTextFrom('#typo3-pagetree-tree [tabindex="0"]')
189  );
190  }
191 }
‪TYPO3\CMS\Core\Exception
Definition: Exception.php:21
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\focusPageWithDownAndUpKey
‪focusPageWithDownAndUpKey(ApplicationTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:64
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\focusPageWithDownKeyAndOpenItWithEnter
‪focusPageWithDownKeyAndOpenItWithEnter(ApplicationTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:48
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree\openPath
‪openPath(array $path)
Definition: PageTree.php:76
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest
Definition: SelectPagetreeWithKeyboardCest.php:29
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\focusFirstPageTreeItemWithHomeKey
‪focusFirstPageTreeItemWithHomeKey(ApplicationTester $I, PageTree $pageTree)
Definition: SelectPagetreeWithKeyboardCest.php:172
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\focusLastPageTreeItemWithEndKey
‪focusLastPageTreeItemWithEndKey(ApplicationTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:154
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\collapseSubtreeWithLeftArrow
‪collapseSubtreeWithLeftArrow(ApplicationTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:125
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\expandSubtreeWithRightArrow
‪expandSubtreeWithRightArrow(ApplicationTester $I)
Definition: SelectPagetreeWithKeyboardCest.php:83
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess
Definition: SelectPagetreeWithKeyboardCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Support\Helper\PageTree
Definition: PageTree.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Application\PageTree\KeyboardAccess\SelectPagetreeWithKeyboardCest\_before
‪_before(ApplicationTester $I, PageTree $pageTree)
Definition: SelectPagetreeWithKeyboardCest.php:35