Skip to content

Commit 681ad1a

Browse files
committed
chore: fix a bug in flaky move test
1 parent aa8ea7f commit 681ad1a

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

test/webdriverio/test/move_test.ts

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@ suite('Move start tests', function () {
4545
// and block connected to selected block's next connection.
4646
const info = await getFocusedNeighbourInfo(this.browser);
4747

48-
chai.assert(info.parentId, 'selected block has no parent block');
48+
chai.assert.exists(
49+
info.parentId,
50+
'selected block should have parent block',
51+
);
4952
chai.assert(
5053
typeof info.parentIndex === 'number',
51-
'parent connection index not found',
54+
'parent connection index should exist and be a number',
5255
);
53-
chai.assert(info.nextId, 'selected block has no next block');
56+
chai.assert.exists(info.nextId, 'selected block should have next block');
5457

5558
// Start move using keyboard shortcut.
5659
await sendKeyAndWait(this.browser, 'm');
@@ -59,12 +62,12 @@ suite('Move start tests', function () {
5962
// next/previous connections, and same thing connected to value
6063
// input.
6164
const newInfo = await getFocusedNeighbourInfo(this.browser);
62-
chai.assert(
63-
newInfo.parentId === null,
65+
chai.assert.isNull(
66+
newInfo.parentId,
6467
'moving block should have no parent block',
6568
);
66-
chai.assert(
67-
newInfo.nextId === null,
69+
chai.assert.isNull(
70+
newInfo.nextId,
6871
'moving block should have no next block',
6972
);
7073
chai.assert.strictEqual(
@@ -106,16 +109,21 @@ suite('Move start tests', function () {
106109
// and block connected to selected block's value input.
107110
const info = await getFocusedNeighbourInfo(this.browser);
108111

109-
chai.assert(info.parentId, 'selected block has no parent block');
112+
chai.assert.exists(
113+
info.parentId,
114+
'selected block should have parent block',
115+
);
110116
chai.assert(
111117
typeof info.parentIndex === 'number',
112-
'parent connection index not found',
118+
'parent connection index should exist and be a number',
119+
);
120+
chai.assert.exists(
121+
info.valueId,
122+
'selected block should have child value block',
113123
);
114-
chai.assert(info.valueId, 'selected block has no child value block');
115124

116125
// Start move using context menu (using keyboard nav).
117126
await sendKeyAndWait(this.browser, [Key.Ctrl, Key.Return]);
118-
await sendKeyAndWait(this.browser, 'm');
119127
await keyDown(
120128
this.browser,
121129
(await contextMenuItems(this.browser)).findIndex(({text}) =>
@@ -128,12 +136,12 @@ suite('Move start tests', function () {
128136
// next/previous connections, and same thing connected to value
129137
// input.
130138
const newInfo = await getFocusedNeighbourInfo(this.browser);
131-
chai.assert(
132-
newInfo.parentId === null,
139+
chai.assert.isNull(
140+
newInfo.parentId,
133141
'moving block should have no parent block',
134142
);
135-
chai.assert(
136-
newInfo.nextId === null,
143+
chai.assert.isNull(
144+
newInfo.nextId,
137145
'moving block should have no next block',
138146
);
139147
chai.assert.strictEqual(

0 commit comments

Comments
 (0)