Skip to content

Commit a3abe12

Browse files
committed
chore: add tests
1 parent 0fb3807 commit a3abe12

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

test/webdriverio/test/basic_test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,4 +349,18 @@ suite('Keyboard navigation on Fields', function () {
349349
.expect(await getCurrentFocusedBlockId(this.browser))
350350
.equal('draw_emoji_1');
351351
});
352+
353+
test('Do not navigate while field editor is open', async function () {
354+
// Open a field editor dropdown
355+
await focusOnBlockField(this.browser, 'logic_boolean_1', 'BOOL');
356+
await this.browser.pause(PAUSE_TIME);
357+
await this.browser.keys(Key.Enter);
358+
await this.browser.pause(PAUSE_TIME);
359+
360+
// Try to navigate to a different block
361+
await keyRight(this.browser);
362+
363+
// The same field should still be focused
364+
chai.assert.equal(await getFocusedFieldName(this.browser), 'BOOL');
365+
});
352366
});

test/webdriverio/test/clipboard_test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {
1515
ElementWithId,
1616
tabNavigateToWorkspace,
1717
focusOnBlock,
18+
focusOnBlockField,
19+
blockIsPresent,
1820
} from './test_setup.js';
1921
import {Key, KeyAction, PointerAction, WheelAction} from 'webdriverio';
2022

@@ -111,6 +113,24 @@ suite('Clipboard test', function () {
111113
'Blocks on the workspace should not have changed',
112114
);
113115
});
116+
117+
test('Do not cut block while field editor is open', async function () {
118+
// Open a field editor
119+
await focusOnBlockField(this.browser, 'draw_circle_1_color', 'COLOUR');
120+
await this.browser.pause(PAUSE_TIME);
121+
await this.browser.keys(Key.Enter);
122+
await this.browser.pause(PAUSE_TIME);
123+
124+
// Try to cut block while field editor is open
125+
await this.browser.keys(Key.Ctrl);
126+
await this.browser.keys('x');
127+
await this.browser.keys(Key.Ctrl); // release ctrl key
128+
129+
// Block is not deleted
130+
chai.assert.isTrue(
131+
await blockIsPresent(this.browser, 'draw_circle_1_color'),
132+
);
133+
});
114134
});
115135

116136
/**

test/webdriverio/test/delete_test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
PAUSE_TIME,
1717
tabNavigateToWorkspace,
1818
keyRight,
19+
focusOnBlockField,
1920
} from './test_setup.js';
2021
import {Key} from 'webdriverio';
2122

@@ -218,4 +219,18 @@ suite('Deleting Blocks', function () {
218219
'p5_setup_1',
219220
);
220221
});
222+
223+
test('Do not delete block while field editor is open', async function () {
224+
// Open a field editor
225+
await focusOnBlockField(this.browser, 'colour_picker_1', 'COLOUR');
226+
await this.browser.pause(PAUSE_TIME);
227+
await this.browser.keys(Key.Enter);
228+
await this.browser.pause(PAUSE_TIME);
229+
230+
// Try to delete block while field editor is open
231+
await this.browser.keys(Key.Backspace);
232+
233+
// Block is not deleted
234+
chai.assert.isTrue(await blockIsPresent(this.browser, 'colour_picker_1'));
235+
});
221236
});

0 commit comments

Comments
 (0)