Skip to content

Commit c014210

Browse files
committed
chore: Fix tests.
1 parent e18bd83 commit c014210

File tree

1 file changed

+25
-72
lines changed

1 file changed

+25
-72
lines changed

test/webdriverio/test/basic_test.ts

Lines changed: 25 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ suite('Keyboard navigation on Blocks', function () {
4444
await this.browser.pause(PAUSE_TIME);
4545
}
4646

47-
const selectedId = await this.browser.execute(() => {
48-
return Blockly.common.getSelected()?.id;
49-
});
50-
chai.assert.equal(selectedId, 'controls_repeat_1');
47+
chai
48+
.expect(await getCurrentFocusNodeId(this.browser))
49+
.to.include('controls_if_2');
5150
});
5251

53-
test('Down from statement block selects next connection', async function () {
52+
test('Down from statement block selects next block across stacks', async function () {
5453
await tabNavigateToWorkspace(this.browser);
5554
await this.browser.pause(PAUSE_TIME);
5655
await setCurrentCursorNodeById(this.browser, 'p5_canvas_1');
@@ -60,15 +59,10 @@ suite('Keyboard navigation on Blocks', function () {
6059

6160
chai
6261
.expect(await getCurrentFocusNodeId(this.browser))
63-
.to.include('p5_canvas_1_connection_');
64-
65-
chai.assert.equal(
66-
await getFocusedConnectionType(this.browser),
67-
Blockly.ConnectionType.NEXT_STATEMENT,
68-
);
62+
.to.include('p5_draw_1');
6963
});
7064

71-
test("Up from statement block selects previous block's connection", async function () {
65+
test('Up from statement block selects previous block', async function () {
7266
await tabNavigateToWorkspace(this.browser);
7367
await this.browser.pause(PAUSE_TIME);
7468
await setCurrentCursorNodeById(this.browser, 'simple_circle_1');
@@ -78,15 +72,10 @@ suite('Keyboard navigation on Blocks', function () {
7872

7973
chai
8074
.expect(await getCurrentFocusNodeId(this.browser))
81-
.to.include('draw_emoji_1_connection_');
82-
83-
chai.assert.equal(
84-
await getFocusedConnectionType(this.browser),
85-
Blockly.ConnectionType.NEXT_STATEMENT,
86-
);
75+
.to.include('draw_emoji_1');
8776
});
8877

89-
test('Down from parent block selects input connection', async function () {
78+
test('Down from parent block selects first child block', async function () {
9079
await tabNavigateToWorkspace(this.browser);
9180
await this.browser.pause(PAUSE_TIME);
9281
await setCurrentCursorNodeById(this.browser, 'p5_setup_1');
@@ -95,15 +84,10 @@ suite('Keyboard navigation on Blocks', function () {
9584
await this.browser.pause(PAUSE_TIME);
9685
chai
9786
.expect(await getCurrentFocusNodeId(this.browser))
98-
.to.include('p5_setup_1_connection_');
99-
100-
chai.assert.equal(
101-
await getFocusedConnectionType(this.browser),
102-
Blockly.ConnectionType.NEXT_STATEMENT,
103-
);
87+
.to.include('p5_canvas_1');
10488
});
10589

106-
test('Up from child block selects input connection', async function () {
90+
test('Up from child block selects parent block', async function () {
10791
await tabNavigateToWorkspace(this.browser);
10892
await this.browser.pause(PAUSE_TIME);
10993
await setCurrentCursorNodeById(this.browser, 'p5_canvas_1');
@@ -112,12 +96,7 @@ suite('Keyboard navigation on Blocks', function () {
11296
await this.browser.pause(PAUSE_TIME);
11397
chai
11498
.expect(await getCurrentFocusNodeId(this.browser))
115-
.to.include('p5_setup_1_connection_');
116-
117-
chai.assert.equal(
118-
await getFocusedConnectionType(this.browser),
119-
Blockly.ConnectionType.NEXT_STATEMENT,
120-
);
99+
.to.include('p5_setup_1');
121100
});
122101

123102
test('Right from block selects first field', async function () {
@@ -205,8 +184,7 @@ suite('Keyboard navigation on Blocks', function () {
205184
);
206185
});
207186

208-
// Test will fail until we update to a newer version of field-colour
209-
test.skip("Right from last inline input selects block's next connection", async function () {
187+
test('Right from last inline input selects next block', async function () {
210188
await tabNavigateToWorkspace(this.browser);
211189
await this.browser.pause(PAUSE_TIME);
212190
await setCurrentCursorNodeById(this.browser, 'colour_picker_1');
@@ -216,16 +194,10 @@ suite('Keyboard navigation on Blocks', function () {
216194

217195
chai
218196
.expect(await getCurrentFocusNodeId(this.browser))
219-
.to.include('simple_circle_1_connection_');
220-
221-
chai.assert.equal(
222-
await getFocusedConnectionType(this.browser),
223-
Blockly.ConnectionType.NEXT_STATEMENT,
224-
);
197+
.to.include('controls_repeat_ext_1');
225198
});
226199

227-
// Test will fail until we update to a newer version of field-colour
228-
test.skip("Down from inline input selects block's next connection", async function () {
200+
test('Down from inline input selects next block', async function () {
229201
await tabNavigateToWorkspace(this.browser);
230202
await this.browser.pause(PAUSE_TIME);
231203
await setCurrentCursorNodeById(this.browser, 'colour_picker_1');
@@ -235,25 +207,20 @@ suite('Keyboard navigation on Blocks', function () {
235207

236208
chai
237209
.expect(await getCurrentFocusNodeId(this.browser))
238-
.to.include('simple_circle_1_connection_');
239-
240-
chai.assert.equal(
241-
await getFocusedConnectionType(this.browser),
242-
Blockly.ConnectionType.NEXT_STATEMENT,
243-
);
210+
.to.include('controls_repeat_ext_1');
244211
});
245212

246-
test("Down from inline input selects block's child connection", async function () {
213+
test("Down from inline input selects block's child block", async function () {
247214
await tabNavigateToWorkspace(this.browser);
248215
await this.browser.pause(PAUSE_TIME);
249-
await setCurrentCursorNodeById(this.browser, 'math_number_2');
216+
await setCurrentCursorNodeById(this.browser, 'logic_boolean_1');
250217
await this.browser.pause(PAUSE_TIME);
251218
await this.browser.keys(Key.ArrowDown);
252219
await this.browser.pause(PAUSE_TIME);
253220

254221
chai
255222
.expect(await getCurrentFocusNodeId(this.browser))
256-
.to.include('controls_repeat_ext_1_connection_');
223+
.to.include('text_print_1');
257224
});
258225

259226
test('Right from text block selects shadow block then field', async function () {
@@ -278,11 +245,7 @@ suite('Keyboard navigation on Blocks', function () {
278245

279246
chai
280247
.expect(await getCurrentFocusNodeId(this.browser))
281-
.to.include('text_print_1_connection_');
282-
chai.assert.equal(
283-
await getFocusedConnectionType(this.browser),
284-
Blockly.ConnectionType.NEXT_STATEMENT,
285-
);
248+
.to.include('controls_repeat_1');
286249
});
287250
});
288251

@@ -364,7 +327,7 @@ suite('Keyboard navigation on Fields', function () {
364327
chai.assert.equal(await getFocusedFieldName(this.browser), 'WIDTH');
365328
});
366329

367-
test("Right from second field selects block's next connection", async function () {
330+
test('Right from second field selects next block', async function () {
368331
await tabNavigateToWorkspace(this.browser);
369332
await this.browser.pause(PAUSE_TIME);
370333
await setCurrentCursorNodeByIdAndFieldName(
@@ -378,10 +341,10 @@ suite('Keyboard navigation on Fields', function () {
378341

379342
chai
380343
.expect(await getCurrentFocusNodeId(this.browser))
381-
.to.include('p5_canvas_1_connection_');
344+
.to.include('p5_draw_1');
382345
});
383346

384-
test("Down from field selects block's next connection", async function () {
347+
test('Down from field selects next block', async function () {
385348
await tabNavigateToWorkspace(this.browser);
386349
await this.browser.pause(PAUSE_TIME);
387350
await setCurrentCursorNodeByIdAndFieldName(
@@ -395,15 +358,10 @@ suite('Keyboard navigation on Fields', function () {
395358

396359
chai
397360
.expect(await getCurrentFocusNodeId(this.browser))
398-
.to.include('p5_canvas_1_connection_');
399-
400-
chai.assert.equal(
401-
await getFocusedConnectionType(this.browser),
402-
Blockly.ConnectionType.NEXT_STATEMENT,
403-
);
361+
.to.include('p5_draw_1');
404362
});
405363

406-
test("Down from field selects block's child connection", async function () {
364+
test("Down from field selects block's child block", async function () {
407365
await tabNavigateToWorkspace(this.browser);
408366
await this.browser.pause(PAUSE_TIME);
409367
await setCurrentCursorNodeByIdAndFieldName(
@@ -417,11 +375,6 @@ suite('Keyboard navigation on Fields', function () {
417375

418376
chai
419377
.expect(await getCurrentFocusNodeId(this.browser))
420-
.to.include('controls_repeat_1_connection_');
421-
422-
chai.assert.equal(
423-
await getFocusedConnectionType(this.browser),
424-
Blockly.ConnectionType.NEXT_STATEMENT,
425-
);
378+
.to.include('draw_emoji_1');
426379
});
427380
});

0 commit comments

Comments
 (0)