@@ -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,34 +109,47 @@ 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' ) ;
119- await keyDown (
120- this . browser ,
121- ( await contextMenuItems ( this . browser ) ) . findIndex ( ( { text} ) =>
122- text . includes ( 'Move' ) ,
123- ) ,
127+
128+ // Find how many times to press the down arrow
129+ const index = ( await contextMenuItems ( this . browser ) ) . findIndex ( ( { text} ) =>
130+ text . includes ( 'Move' ) ,
131+ ) ;
132+ chai . assert . isAbove (
133+ index ,
134+ - 1 ,
135+ 'expected Move to appear in context menu items' ,
124136 ) ;
137+ await keyDown ( this . browser , index ) ;
125138 await sendKeyAndWait ( this . browser , Key . Return ) ;
126139
140+ // Wait for the move icon to appear so we know we're in move mode.
141+ await this . browser . $ ( '.blocklyMoveIndicatorBubble' ) . waitForExist ( ) ;
142+
127143 // Check that the moving block has nothing connected it its
128144 // next/previous connections, and same thing connected to value
129145 // input.
130146 const newInfo = await getFocusedNeighbourInfo ( this . browser ) ;
131- chai . assert (
132- newInfo . parentId === null ,
147+ chai . assert . isNull (
148+ newInfo . parentId ,
133149 'moving block should have no parent block' ,
134150 ) ;
135- chai . assert (
136- newInfo . nextId === null ,
151+ chai . assert . isNull (
152+ newInfo . nextId ,
137153 'moving block should have no next block' ,
138154 ) ;
139155 chai . assert . strictEqual (
0 commit comments