Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions test/webdriverio/test/basic_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ suite('Keyboard navigation on Blocks', function () {
.to.include('controls_repeat_ext_1_connection_');
});

// This test fails because the curly quote icons get selected.
test.skip('Right from text block selects input and skips curly quote icons', async function () {
test('Right from text block selects shadow block then field', async function () {
await tabNavigateToWorkspace(this.browser);
await this.browser.pause(PAUSE_TIME);
await setCurrentCursorNodeById(this.browser, 'text_print_1');
Expand All @@ -270,10 +269,16 @@ suite('Keyboard navigation on Blocks', function () {
await this.browser.keys(Key.ArrowRight);
await this.browser.pause(PAUSE_TIME);

chai.assert.equal(
await getCurrentFocusNodeId(this.browser),
'text_print_1',
);
chai
.expect(await getCurrentFocusNodeId(this.browser))
.to.include('text_1_field_');

await this.browser.keys(Key.ArrowRight);
await this.browser.pause(PAUSE_TIME);

chai
.expect(await getCurrentFocusNodeId(this.browser))
.to.include('text_print_1_connection_');
chai.assert.equal(
await getFocusedConnectionType(this.browser),
Blockly.ConnectionType.NEXT_STATEMENT,
Expand All @@ -282,7 +287,7 @@ suite('Keyboard navigation on Blocks', function () {
});

// TODO(#499) These tests fail because focusing on a field doesn't update the cursor
suite.skip('Keyboard navigation on Fields', function () {
suite('Keyboard navigation on Fields', function () {
// Setting timeout to unlimited as these tests take a longer time to run than most mocha test
this.timeout(0);

Expand Down Expand Up @@ -337,7 +342,7 @@ suite.skip('Keyboard navigation on Fields', function () {
.expect(await getCurrentFocusNodeId(this.browser))
.to.include('p5_canvas_1_field_');

chai.assert.equal(await getFocusedFieldName(this.browser), 'HIGHT');
chai.assert.equal(await getFocusedFieldName(this.browser), 'HEIGHT');
});

test('Left from second field selects first field', async function () {
Expand Down Expand Up @@ -371,10 +376,9 @@ suite.skip('Keyboard navigation on Fields', function () {
await this.browser.keys(Key.ArrowRight);
await this.browser.pause(PAUSE_TIME);

chai.assert.containSubset(
await getCurrentFocusNodeId(this.browser),
'p5_canvas_1_connection_',
);
chai
.expect(await getCurrentFocusNodeId(this.browser))
.to.include('p5_canvas_1_connection_');
});

test("Down from field selects block's next connection", async function () {
Expand Down Expand Up @@ -417,7 +421,7 @@ suite.skip('Keyboard navigation on Fields', function () {

chai.assert.equal(
await getFocusedConnectionType(this.browser),
Blockly.ConnectionType.INPUT_VALUE,
Blockly.ConnectionType.NEXT_STATEMENT,
);
});
});
2 changes: 1 addition & 1 deletion test/webdriverio/test/insert_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
testSetup,
} from './test_setup.js';

suite.only('Insert test', function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops!

Would need a separate run step for CI vs local to sanity check this but might be worth it.

mochajs/mocha#5299

suite('Insert test', function () {
// Setting timeout to unlimited as these tests take longer time to run
this.timeout(0);

Expand Down
6 changes: 5 additions & 1 deletion test/webdriverio/test/test_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ export async function setCurrentCursorNodeByIdAndFieldName(
const block = workspaceSvg.getBlockById(blockId);
const field = block?.getField(fieldName);
if (field) {
field.getFocusableElement()?.focus();
// TODO: Stop referencing getCursor() and use focus() instead.
// getCursor().setCurNode() calls Marker.setCurNode(), but focus() does
// not accomplish the same goal yet.
workspaceSvg.getCursor()?.setCurNode(field);
// field.getFocusableElement()?.focus();
}
},
blockId,
Expand Down
Loading