Skip to content

Commit 0572938

Browse files
committed
chore(tests): Add block with statment inputs to statement test blocks
Add a new, E-shaped block with ID complex_mover to moveStatementTestBlocks, and update expected test results for statement move tests.
1 parent 3740823 commit 0572938

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed

test/loadTestBlocks.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -870,17 +870,17 @@ const moveStartTestBlocks = {
870870
},
871871
};
872872

873-
// A bunch of statement blocks. The draw_emoji block will be
874-
// (constrained) moved up, down, left and right to verify that it
875-
// visits the expected positions.
873+
// A bunch of statement blocks. The blocks with IDs simple_mover and
874+
// complex_mover will be (constrained-)moved up, down, left and right
875+
// to verify that they visit all the expected candidate connections.
876876
const moveStatementTestBlocks = {
877877
'blocks': {
878878
'languageVersion': 0,
879879
'blocks': [
880880
{
881881
'type': 'p5_setup',
882882
'id': 'p5_setup',
883-
'x': 0,
883+
'x': 75,
884884
'y': 75,
885885
'deletable': false,
886886
'inputs': {
@@ -897,9 +897,18 @@ const moveStatementTestBlocks = {
897897
'next': {
898898
'block': {
899899
'type': 'draw_emoji',
900-
'id': 'draw_emoji',
900+
'id': 'simple_mover',
901901
'fields': {
902-
'emoji': '✨',
902+
'emoji': '✨'
903+
},
904+
'next': {
905+
'block': {
906+
'type': 'controls_if',
907+
'id': 'complex_mover',
908+
'extraState': {
909+
'hasElse': true,
910+
},
911+
},
903912
},
904913
},
905914
},
@@ -910,8 +919,11 @@ const moveStatementTestBlocks = {
910919
{
911920
'type': 'text_print',
912921
'id': 'text_print',
913-
'x': 0,
914-
'y': 300,
922+
"disabledReasons": [
923+
"MANUALLY_DISABLED"
924+
],
925+
'x': 75,
926+
'y': 400,
915927
'inputs': {
916928
'TEXT': {
917929
'shadow': {
@@ -956,8 +968,8 @@ const moveStatementTestBlocks = {
956968
{
957969
'type': 'p5_draw',
958970
'id': 'p5_draw',
959-
'x': 0,
960-
'y': 753,
971+
'x': 75,
972+
'y': 950,
961973
'deletable': false,
962974
},
963975
],

test/webdriverio/test/move_test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,17 @@ suite('Statement move tests', function () {
174174
});
175175

176176
/** ID of a statement block with no inputs. */
177-
const BLOCK_SIMPLE = 'draw_emoji';
177+
const BLOCK_SIMPLE = 'simple_mover';
178178

179179
/**
180180
* Expected connection candidates when moving BLOCK_SIMPLE, after
181181
* pressing right or down arrow n times.
182182
*/
183183
const EXPECTED_SIMPLE = [
184184
{id: 'p5_canvas', index: 1, ownIndex: 0}, // Next; starting location.
185+
{id: 'complex_mover', index: 3, ownIndex: 0}, // "If" statement input.
186+
{id: 'complex_mover', index: 4, ownIndex: 0}, // "Else" statement input.
187+
{id: 'complex_mover', index: 1, ownIndex: 0}, // Next.
185188
{id: 'text_print', index: 0, ownIndex: 1}, // Previous.
186189
{id: 'text_print', index: 1, ownIndex: 0}, // Next.
187190
{id: 'controls_if', index: 3, ownIndex: 0}, // "If" statement input.
@@ -198,9 +201,9 @@ suite('Statement move tests', function () {
198201
test(
199202
'Constrained move of simple stack block right',
200203
moveTest(BLOCK_SIMPLE, Key.ArrowRight, EXPECTED_SIMPLE, {
201-
parentId: null,
202-
parentIndex: null,
203-
nextId: 'text_print',
204+
parentId: 'complex_mover',
205+
parentIndex: 3,
206+
nextId: null,
204207
valueId: null,
205208
}),
206209
);
@@ -216,9 +219,9 @@ suite('Statement move tests', function () {
216219
test(
217220
'Constrained move of simple stack block down',
218221
moveTest(BLOCK_SIMPLE, Key.ArrowDown, EXPECTED_SIMPLE, {
219-
parentId: null,
220-
parentIndex: null,
221-
nextId: 'text_print',
222+
parentId: 'complex_mover',
223+
parentIndex: 3,
224+
nextId: null,
222225
valueId: null,
223226
}),
224227
);

0 commit comments

Comments
 (0)