Skip to content

Commit e2105db

Browse files
committed
test(Mover): Add complex expression right/left move tests
1 parent 2bbd602 commit e2105db

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/webdriverio/test/move_test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,32 @@ suite(`Value expression move tests`, function () {
415415
EXPECTED_UNARY_RIGHT.slice(1).reverse(),
416416
);
417417

418+
/** Serialized value block with a single free (external) input. */
419+
const VALUE_COMPLEX = {
420+
type: 'text_join',
421+
id: 'complex_mover',
422+
};
423+
/**
424+
* Expected connection candidates when moving VALUE_COMPLEX after
425+
* pressing ArrowRight n times.
426+
*/
427+
const EXPECTED_COMPLEX_RIGHT = EXPECTED_SIMPLE_RIGHT.concat([
428+
// TODO(#702): Due to a bug in KeyboardDragStrategy, certain
429+
// connection candidates that can be found using the mouse are not
430+
// visited when doing a keyboard move. They appear in the list
431+
// below, but commented out for now. They should be uncommented
432+
// when bug is fixed.
433+
{id: 'join0', index: 0, ownIndex: 2}, // Unattached block to own input.
434+
// {id: 'join0', index: 0, ownIndex: 1}, // Unattached block to own input.
435+
]);
436+
/**
437+
* Expected connection candidates when moving row consisting of
438+
* BLOCK_COMPLEX on its own after pressing ArrowLEFT n times.
439+
*/
440+
const EXPECTED_COMPLEX_LEFT = EXPECTED_COMPLEX_RIGHT.slice(0, 1).concat(
441+
EXPECTED_COMPLEX_RIGHT.slice(1).reverse(),
442+
);
443+
418444
for (const renderer of ['geras', 'thrasos', 'zelos']) {
419445
// TODO(#707): These tests fail when run using zelos, so for now
420446
// we skip entire suite. Stop skipping suite when bug is fixed.
@@ -472,6 +498,20 @@ suite(`Value expression move tests`, function () {
472498
moveTest(VALUE_UNARY.id, Key.ArrowLeft, EXPECTED_UNARY_LEFT),
473499
);
474500
});
501+
502+
suite('Constrained moves of a complex expression block', function () {
503+
setup(async function () {
504+
await appendBlock(this.browser, VALUE_COMPLEX, 'join0', 'ADD0');
505+
});
506+
test(
507+
'moving right',
508+
moveTest(VALUE_COMPLEX.id, Key.ArrowRight, EXPECTED_COMPLEX_RIGHT),
509+
);
510+
test(
511+
'moving left',
512+
moveTest(VALUE_COMPLEX.id, Key.ArrowLeft, EXPECTED_COMPLEX_LEFT),
513+
);
514+
});
475515
});
476516
}
477517
});

0 commit comments

Comments
 (0)