diff --git a/test/webdriverio/test/basic_test.ts b/test/webdriverio/test/basic_test.ts index 276f6835..2585c99b 100644 --- a/test/webdriverio/test/basic_test.ts +++ b/test/webdriverio/test/basic_test.ts @@ -49,7 +49,7 @@ suite('Keyboard navigation on Blocks', function () { await tabNavigateToWorkspace(this.browser); await this.browser.pause(PAUSE_TIME); - await keyDown(this.browser, 14); + await keyDown(this.browser, 22); chai .expect(await getCurrentFocusedBlockId(this.browser)) @@ -59,7 +59,9 @@ suite('Keyboard navigation on Blocks', function () { test('Down from statement block selects next block across stacks', async function () { await focusOnBlock(this.browser, 'p5_canvas_1'); await this.browser.pause(PAUSE_TIME); - await keyDown(this.browser); + // Key down twice; the first down moves to the next connection on the + // selected block. + await keyDown(this.browser, 2); chai .expect(await getCurrentFocusedBlockId(this.browser)) @@ -164,7 +166,9 @@ suite('Keyboard navigation on Blocks', function () { test('Right from last inline input selects next block', async function () { await focusOnBlock(this.browser, 'colour_picker_1'); await this.browser.pause(PAUSE_TIME); - await keyRight(this.browser); + // Go right twice; first one selects the next connection on the colour + // picker's parent block. + await keyRight(this.browser, 2); chai .expect(await getCurrentFocusedBlockId(this.browser)) @@ -174,7 +178,9 @@ suite('Keyboard navigation on Blocks', function () { test('Down from inline input selects next block', async function () { await focusOnBlock(this.browser, 'colour_picker_1'); await this.browser.pause(PAUSE_TIME); - await keyDown(this.browser); + // Go down twice; first one selects the next connection on the colour + // picker's parent block. + await keyDown(this.browser, 2); chai .expect(await getCurrentFocusedBlockId(this.browser)) @@ -204,7 +210,8 @@ suite('Keyboard navigation on Blocks', function () { .expect(await getCurrentFocusNodeId(this.browser)) .to.include('text_1_field_'); - await keyRight(this.browser); + // Go right twice; first one selects the next connection on the print block. + await keyRight(this.browser, 2); chai .expect(await getCurrentFocusedBlockId(this.browser)) @@ -284,7 +291,9 @@ suite('Keyboard navigation on Fields', function () { test('Right from second field selects next block', async function () { await focusOnBlockField(this.browser, 'p5_canvas_1', 'HEIGHT'); await this.browser.pause(PAUSE_TIME); - await keyRight(this.browser); + // Go right twice; first one selects the next connection on the create + // canvas block. + await keyRight(this.browser, 2); chai .expect(await getCurrentFocusedBlockId(this.browser)) @@ -294,7 +303,9 @@ suite('Keyboard navigation on Fields', function () { test('Down from field selects next block', async function () { await focusOnBlockField(this.browser, 'p5_canvas_1', 'WIDTH'); await this.browser.pause(PAUSE_TIME); - await keyDown(this.browser); + // Go down twice; first one selects the next connection on the create + // canvas block. + await keyDown(this.browser, 2); chai .expect(await getCurrentFocusedBlockId(this.browser)) diff --git a/test/webdriverio/test/flyout_test.ts b/test/webdriverio/test/flyout_test.ts index 4e438f6d..d9457545 100644 --- a/test/webdriverio/test/flyout_test.ts +++ b/test/webdriverio/test/flyout_test.ts @@ -196,7 +196,7 @@ suite('Toolbox and flyout test', function () { await tabNavigateToWorkspace(this.browser); // Note that two tabs are needed here to move past the flyout. - await keyDown(this.browser, 3); + await keyDown(this.browser, 4); await tabNavigateBackward(this.browser); await tabNavigateForward(this.browser); await tabNavigateForward(this.browser); diff --git a/test/webdriverio/test/stack_navigation.ts b/test/webdriverio/test/stack_navigation.ts index b26f273f..475c08be 100644 --- a/test/webdriverio/test/stack_navigation.ts +++ b/test/webdriverio/test/stack_navigation.ts @@ -59,14 +59,16 @@ suite('Stack navigation', function () { await getCurrentFocusNodeId(this.browser), ); await sendKeyAndWait(this.browser, 'b'); - chai.assert.equal( - 'p5_draw_1', - await getCurrentFocusedBlockId(this.browser), + chai.assert.isTrue( + (await getCurrentFocusNodeId(this.browser))?.startsWith( + 'draw_circle_2_connection', + ), ); await sendKeyAndWait(this.browser, 'b'); - chai.assert.equal( - 'p5_setup_1', - await getCurrentFocusedBlockId(this.browser), + chai.assert.isTrue( + (await getCurrentFocusNodeId(this.browser))?.startsWith( + 'set_background_color_1_connection', + ), ); }); }); diff --git a/test/webdriverio/test/workspace_comment_test.ts b/test/webdriverio/test/workspace_comment_test.ts index 7f9e4a75..fa733181 100644 --- a/test/webdriverio/test/workspace_comment_test.ts +++ b/test/webdriverio/test/workspace_comment_test.ts @@ -71,7 +71,8 @@ suite('Workspace comment navigation', function () { test('Navigate forward from block to workspace comment', async function () { await focusOnBlock(this.browser, 'p5_canvas_1'); - await keyDown(this.browser); + // Key down twice; the first focuses the block's next connection. + await keyDown(this.browser, 2); const focusedNodeId = await getCurrentFocusNodeId(this.browser); chai.assert.equal(focusedNodeId, this.commentId1); }); @@ -92,7 +93,8 @@ suite('Workspace comment navigation', function () { test('Navigate backward from workspace comment to block', async function () { await focusOnWorkspaceComment(this.browser, this.commentId1); - await keyUp(this.browser); + // Key up twice; the first focuses the block's next connection. + await keyUp(this.browser, 2); const focusedBlock = await getFocusedBlockType(this.browser); chai.assert.equal(focusedBlock, 'p5_canvas'); });