Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 15 additions & 2 deletions test/webdriverio/test/move_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
testSetup,
sendKeyAndWait,
keyDown,
contextMenuItems,
} from './test_setup.js';

suite('Move tests', function () {
Expand All @@ -33,6 +34,8 @@ suite('Move tests', function () {
// moved, with subsequent statement blocks below it in the stack
// reattached to where the moving block was - i.e., that a stack
// heal will occur.
//
// Also tests initating a move using the shortcut key.
test('Start moving statement blocks', async function () {
for (let i = 1; i < 7; i++) {
// Navigate to statement_<i>.
Expand All @@ -50,7 +53,7 @@ suite('Move tests', function () {
);
chai.assert(info.nextId, 'selected block has no next block');

// Start move.
// Start move using keyboard shortcut.
await sendKeyAndWait(this.browser, 'm');

// Check that the moving block has nothing connected it its
Expand Down Expand Up @@ -93,6 +96,8 @@ suite('Move tests', function () {
// When a move of a value block begins, it is expected that block
// and all blocks connected to its inputs will be moved - i.e., that
// a stack heal (really: unary operator chain heal) will NOT occur.
//
// Also tests initiating a move via the context menu.
test('Start moving value blocks', async function () {
for (let i = 1; i < 7; i++) {
// Navigate to statement_<i>.
Expand All @@ -110,8 +115,16 @@ suite('Move tests', function () {
);
chai.assert(info.valueId, 'selected block has no child value block');

// Start move.
// Start move using context menu (using keyboard nav).
await sendKeyAndWait(this.browser, [Key.Ctrl, Key.Return]);
await sendKeyAndWait(this.browser, 'm');
await keyDown(
this.browser,
(await contextMenuItems(this.browser)).findIndex(({text}) =>
text.includes('Move'),
),
);
await sendKeyAndWait(this.browser, Key.Return);

// Check that the moving block has nothing connected it its
// next/previous connections, and same thing connected to value
Expand Down
10 changes: 8 additions & 2 deletions test/webdriverio/test/test_setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,15 @@ export async function sendKeyAndWait(
keys: string | string[],
times = 1,
) {
for (let i = 0; i < times; i++) {
if (PAUSE_TIME === 0) {
// Send all keys in one call if no pauses needed.
keys = Array(times).fill(keys).flat();
await browser.keys(keys);
await browser.pause(PAUSE_TIME);
} else {
for (let i = 0; i < times; i++) {
await browser.keys(keys);
await browser.pause(PAUSE_TIME);
}
}
}

Expand Down
Loading