Skip to content

Commit 2698964

Browse files
committed
chore: fix tests
1 parent eaf28e1 commit 2698964

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

test/webdriverio/test/keyboard_mode_test.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
testSetup,
1212
testFileLocations,
1313
PAUSE_TIME,
14-
focusWorkspace,
1514
getBlockElementById,
15+
tabNavigateToWorkspace,
1616
} from './test_setup.js';
1717
import {Key} from 'webdriverio';
1818

@@ -28,20 +28,22 @@ suite(
2828
// Setting timeout to unlimited as these tests take a longer time to run than most mocha tests
2929
this.timeout(0);
3030

31-
// Setup Selenium for all of the tests
32-
suiteSetup(async function () {
31+
setup(async function () {
32+
// Reload the page between tests
3333
this.browser = await testSetup(testFileLocations.NAVIGATION_TEST_BLOCKS);
34-
});
3534

36-
setup(async function () {
35+
await this.browser.pause(PAUSE_TIME);
36+
3737
// Reset the keyboard navigation state between tests.
3838
await this.browser.execute(() => {
3939
Blockly.keyboardNavigationController.setIsActive(false);
4040
});
41+
42+
// Start with the workspace focused.
43+
await tabNavigateToWorkspace(this.browser);
4144
});
4245

4346
test('T to open toolbox enables keyboard mode', async function () {
44-
await focusWorkspace(this.browser);
4547
await this.browser.pause(PAUSE_TIME);
4648
await this.browser.keys('t');
4749
await this.browser.pause(PAUSE_TIME);
@@ -50,7 +52,6 @@ suite(
5052
});
5153

5254
test('M for move mode enables keyboard mode', async function () {
53-
await focusWorkspace(this.browser);
5455
await focusOnBlock(this.browser, 'controls_if_2');
5556
await this.browser.pause(PAUSE_TIME);
5657
await this.browser.keys('m');
@@ -59,7 +60,6 @@ suite(
5960
});
6061

6162
test('W for workspace cursor enables keyboard mode', async function () {
62-
await focusWorkspace(this.browser);
6363
await this.browser.pause(PAUSE_TIME);
6464
await this.browser.keys('w');
6565
await this.browser.pause(PAUSE_TIME);
@@ -68,7 +68,6 @@ suite(
6868
});
6969

7070
test('X to disconnect enables keyboard mode', async function () {
71-
await focusWorkspace(this.browser);
7271
await focusOnBlock(this.browser, 'controls_if_2');
7372
await this.browser.pause(PAUSE_TIME);
7473
await this.browser.keys('x');
@@ -78,8 +77,6 @@ suite(
7877
});
7978

8079
test('Copy does not change keyboard mode state', async function () {
81-
await focusWorkspace(this.browser);
82-
8380
// Make sure we're on a copyable block so that copy occurs
8481
await focusOnBlock(this.browser, 'controls_if_2');
8582
await this.browser.pause(PAUSE_TIME);
@@ -104,8 +101,6 @@ suite(
104101
});
105102

106103
test('Delete does not change keyboard mode state', async function () {
107-
await focusWorkspace(this.browser);
108-
109104
// Make sure we're on a deletable block so that delete occurs
110105
await focusOnBlock(this.browser, 'controls_if_2');
111106
await this.browser.pause(PAUSE_TIME);
@@ -128,7 +123,6 @@ suite(
128123
});
129124

130125
test('Right clicking a block disables keyboard mode', async function () {
131-
await focusWorkspace(this.browser);
132126
await this.browser.execute(() => {
133127
Blockly.keyboardNavigationController.setIsActive(true);
134128
});
@@ -146,8 +140,6 @@ suite(
146140
});
147141

148142
test('Dragging a block with mouse disables keyboard mode', async function () {
149-
await focusWorkspace(this.browser);
150-
151143
await this.browser.execute(() => {
152144
Blockly.keyboardNavigationController.setIsActive(true);
153145
});

0 commit comments

Comments
 (0)