Skip to content

Commit a36f366

Browse files
authored
fix: Fix tests. (#766)
1 parent 05609b7 commit a36f366

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed

test/webdriverio/test/basic_test.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ suite('Keyboard navigation on Blocks', function () {
4949
await tabNavigateToWorkspace(this.browser);
5050
await this.browser.pause(PAUSE_TIME);
5151

52-
await keyDown(this.browser, 14);
52+
await keyDown(this.browser, 22);
5353

5454
chai
5555
.expect(await getCurrentFocusedBlockId(this.browser))
@@ -59,7 +59,9 @@ suite('Keyboard navigation on Blocks', function () {
5959
test('Down from statement block selects next block across stacks', async function () {
6060
await focusOnBlock(this.browser, 'p5_canvas_1');
6161
await this.browser.pause(PAUSE_TIME);
62-
await keyDown(this.browser);
62+
// Key down twice; the first down moves to the next connection on the
63+
// selected block.
64+
await keyDown(this.browser, 2);
6365

6466
chai
6567
.expect(await getCurrentFocusedBlockId(this.browser))
@@ -164,7 +166,9 @@ suite('Keyboard navigation on Blocks', function () {
164166
test('Right from last inline input selects next block', async function () {
165167
await focusOnBlock(this.browser, 'colour_picker_1');
166168
await this.browser.pause(PAUSE_TIME);
167-
await keyRight(this.browser);
169+
// Go right twice; first one selects the next connection on the colour
170+
// picker's parent block.
171+
await keyRight(this.browser, 2);
168172

169173
chai
170174
.expect(await getCurrentFocusedBlockId(this.browser))
@@ -174,7 +178,9 @@ suite('Keyboard navigation on Blocks', function () {
174178
test('Down from inline input selects next block', async function () {
175179
await focusOnBlock(this.browser, 'colour_picker_1');
176180
await this.browser.pause(PAUSE_TIME);
177-
await keyDown(this.browser);
181+
// Go down twice; first one selects the next connection on the colour
182+
// picker's parent block.
183+
await keyDown(this.browser, 2);
178184

179185
chai
180186
.expect(await getCurrentFocusedBlockId(this.browser))
@@ -204,7 +210,8 @@ suite('Keyboard navigation on Blocks', function () {
204210
.expect(await getCurrentFocusNodeId(this.browser))
205211
.to.include('text_1_field_');
206212

207-
await keyRight(this.browser);
213+
// Go right twice; first one selects the next connection on the print block.
214+
await keyRight(this.browser, 2);
208215

209216
chai
210217
.expect(await getCurrentFocusedBlockId(this.browser))
@@ -284,7 +291,9 @@ suite('Keyboard navigation on Fields', function () {
284291
test('Right from second field selects next block', async function () {
285292
await focusOnBlockField(this.browser, 'p5_canvas_1', 'HEIGHT');
286293
await this.browser.pause(PAUSE_TIME);
287-
await keyRight(this.browser);
294+
// Go right twice; first one selects the next connection on the create
295+
// canvas block.
296+
await keyRight(this.browser, 2);
288297

289298
chai
290299
.expect(await getCurrentFocusedBlockId(this.browser))
@@ -294,7 +303,9 @@ suite('Keyboard navigation on Fields', function () {
294303
test('Down from field selects next block', async function () {
295304
await focusOnBlockField(this.browser, 'p5_canvas_1', 'WIDTH');
296305
await this.browser.pause(PAUSE_TIME);
297-
await keyDown(this.browser);
306+
// Go down twice; first one selects the next connection on the create
307+
// canvas block.
308+
await keyDown(this.browser, 2);
298309

299310
chai
300311
.expect(await getCurrentFocusedBlockId(this.browser))

test/webdriverio/test/flyout_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ suite('Toolbox and flyout test', function () {
196196
await tabNavigateToWorkspace(this.browser);
197197

198198
// Note that two tabs are needed here to move past the flyout.
199-
await keyDown(this.browser, 3);
199+
await keyDown(this.browser, 4);
200200
await tabNavigateBackward(this.browser);
201201
await tabNavigateForward(this.browser);
202202
await tabNavigateForward(this.browser);

test/webdriverio/test/stack_navigation.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ suite('Stack navigation', function () {
5959
await getCurrentFocusNodeId(this.browser),
6060
);
6161
await sendKeyAndWait(this.browser, 'b');
62-
chai.assert.equal(
63-
'p5_draw_1',
64-
await getCurrentFocusedBlockId(this.browser),
62+
chai.assert.isTrue(
63+
(await getCurrentFocusNodeId(this.browser))?.startsWith(
64+
'draw_circle_2_connection',
65+
),
6566
);
6667
await sendKeyAndWait(this.browser, 'b');
67-
chai.assert.equal(
68-
'p5_setup_1',
69-
await getCurrentFocusedBlockId(this.browser),
68+
chai.assert.isTrue(
69+
(await getCurrentFocusNodeId(this.browser))?.startsWith(
70+
'set_background_color_1_connection',
71+
),
7072
);
7173
});
7274
});

test/webdriverio/test/workspace_comment_test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ suite('Workspace comment navigation', function () {
7171

7272
test('Navigate forward from block to workspace comment', async function () {
7373
await focusOnBlock(this.browser, 'p5_canvas_1');
74-
await keyDown(this.browser);
74+
// Key down twice; the first focuses the block's next connection.
75+
await keyDown(this.browser, 2);
7576
const focusedNodeId = await getCurrentFocusNodeId(this.browser);
7677
chai.assert.equal(focusedNodeId, this.commentId1);
7778
});
@@ -92,7 +93,8 @@ suite('Workspace comment navigation', function () {
9293

9394
test('Navigate backward from workspace comment to block', async function () {
9495
await focusOnWorkspaceComment(this.browser, this.commentId1);
95-
await keyUp(this.browser);
96+
// Key up twice; the first focuses the block's next connection.
97+
await keyUp(this.browser, 2);
9698
const focusedBlock = await getFocusedBlockType(this.browser);
9799
chai.assert.equal(focusedBlock, 'p5_canvas');
98100
});

0 commit comments

Comments
 (0)