@@ -23,6 +23,7 @@ import {
2323 keyUp ,
2424 keyDown ,
2525 checkForFailures ,
26+ idle ,
2627} from './test_setup.js' ;
2728import { Key } from 'webdriverio' ;
2829
@@ -52,7 +53,7 @@ suite('Keyboard navigation on Blocks', function () {
5253
5354 test ( 'Selected block' , async function ( ) {
5455 await tabNavigateToWorkspace ( this . browser ) ;
55- await this . browser . pause ( PAUSE_TIME ) ;
56+ await idle ( this . browser ) ;
5657
5758 await keyDown ( this . browser , 14 ) ;
5859
@@ -63,7 +64,7 @@ suite('Keyboard navigation on Blocks', function () {
6364
6465 test ( 'Down from statement block selects next block across stacks' , async function ( ) {
6566 await focusOnBlock ( this . browser , 'p5_canvas_1' ) ;
66- await this . browser . pause ( PAUSE_TIME ) ;
67+ await idle ( this . browser ) ;
6768 await keyDown ( this . browser ) ;
6869
6970 chai
@@ -73,7 +74,7 @@ suite('Keyboard navigation on Blocks', function () {
7374
7475 test ( 'Up from statement block selects previous block' , async function ( ) {
7576 await focusOnBlock ( this . browser , 'simple_circle_1' ) ;
76- await this . browser . pause ( PAUSE_TIME ) ;
77+ await idle ( this . browser ) ;
7778 await keyUp ( this . browser ) ;
7879
7980 chai
@@ -83,7 +84,7 @@ suite('Keyboard navigation on Blocks', function () {
8384
8485 test ( 'Down from parent block selects first child block' , async function ( ) {
8586 await focusOnBlock ( this . browser , 'p5_setup_1' ) ;
86- await this . browser . pause ( PAUSE_TIME ) ;
87+ await idle ( this . browser ) ;
8788 await keyDown ( this . browser ) ;
8889 chai
8990 . expect ( await getCurrentFocusedBlockId ( this . browser ) )
@@ -92,7 +93,7 @@ suite('Keyboard navigation on Blocks', function () {
9293
9394 test ( 'Up from child block selects parent block' , async function ( ) {
9495 await focusOnBlock ( this . browser , 'p5_canvas_1' ) ;
95- await this . browser . pause ( PAUSE_TIME ) ;
96+ await idle ( this . browser ) ;
9697 await keyUp ( this . browser ) ;
9798 chai
9899 . expect ( await getCurrentFocusedBlockId ( this . browser ) )
@@ -101,7 +102,7 @@ suite('Keyboard navigation on Blocks', function () {
101102
102103 test ( 'Right from block selects first field' , async function ( ) {
103104 await focusOnBlock ( this . browser , 'p5_canvas_1' ) ;
104- await this . browser . pause ( PAUSE_TIME ) ;
105+ await idle ( this . browser ) ;
105106 await keyRight ( this . browser ) ;
106107
107108 chai
@@ -113,7 +114,7 @@ suite('Keyboard navigation on Blocks', function () {
113114
114115 test ( 'Right from block selects first inline input' , async function ( ) {
115116 await focusOnBlock ( this . browser , 'simple_circle_1' ) ;
116- await this . browser . pause ( PAUSE_TIME ) ;
117+ await idle ( this . browser ) ;
117118 await keyRight ( this . browser ) ;
118119
119120 chai . assert . equal (
@@ -124,7 +125,7 @@ suite('Keyboard navigation on Blocks', function () {
124125
125126 test ( 'Up from inline input selects statement block' , async function ( ) {
126127 await focusOnBlock ( this . browser , 'math_number_2' ) ;
127- await this . browser . pause ( PAUSE_TIME ) ;
128+ await idle ( this . browser ) ;
128129 await keyUp ( this . browser ) ;
129130
130131 chai . assert . equal (
@@ -135,7 +136,7 @@ suite('Keyboard navigation on Blocks', function () {
135136
136137 test ( 'Left from first inline input selects block' , async function ( ) {
137138 await focusOnBlock ( this . browser , 'math_number_2' ) ;
138- await this . browser . pause ( PAUSE_TIME ) ;
139+ await idle ( this . browser ) ;
139140 await keyLeft ( this . browser ) ;
140141
141142 chai . assert . equal (
@@ -146,7 +147,7 @@ suite('Keyboard navigation on Blocks', function () {
146147
147148 test ( 'Right from first inline input selects second inline input' , async function ( ) {
148149 await focusOnBlock ( this . browser , 'math_number_2' ) ;
149- await this . browser . pause ( PAUSE_TIME ) ;
150+ await idle ( this . browser ) ;
150151 await keyRight ( this . browser ) ;
151152
152153 chai . assert . equal (
@@ -157,7 +158,7 @@ suite('Keyboard navigation on Blocks', function () {
157158
158159 test ( 'Left from second inline input selects first inline input' , async function ( ) {
159160 await focusOnBlock ( this . browser , 'math_number_3' ) ;
160- await this . browser . pause ( PAUSE_TIME ) ;
161+ await idle ( this . browser ) ;
161162 await keyLeft ( this . browser ) ;
162163
163164 chai . assert . equal (
@@ -168,7 +169,7 @@ suite('Keyboard navigation on Blocks', function () {
168169
169170 test ( 'Right from last inline input selects next block' , async function ( ) {
170171 await focusOnBlock ( this . browser , 'colour_picker_1' ) ;
171- await this . browser . pause ( PAUSE_TIME ) ;
172+ await idle ( this . browser ) ;
172173 await keyRight ( this . browser ) ;
173174
174175 chai
@@ -178,7 +179,7 @@ suite('Keyboard navigation on Blocks', function () {
178179
179180 test ( 'Down from inline input selects next block' , async function ( ) {
180181 await focusOnBlock ( this . browser , 'colour_picker_1' ) ;
181- await this . browser . pause ( PAUSE_TIME ) ;
182+ await idle ( this . browser ) ;
182183 await keyDown ( this . browser ) ;
183184
184185 chai
@@ -188,7 +189,7 @@ suite('Keyboard navigation on Blocks', function () {
188189
189190 test ( "Down from inline input selects block's child block" , async function ( ) {
190191 await focusOnBlock ( this . browser , 'logic_boolean_1' ) ;
191- await this . browser . pause ( PAUSE_TIME ) ;
192+ await idle ( this . browser ) ;
192193 await keyDown ( this . browser ) ;
193194
194195 chai
@@ -198,7 +199,7 @@ suite('Keyboard navigation on Blocks', function () {
198199
199200 test ( 'Right from text block selects shadow block then field' , async function ( ) {
200201 await focusOnBlock ( this . browser , 'text_print_1' ) ;
201- await this . browser . pause ( PAUSE_TIME ) ;
202+ await idle ( this . browser ) ;
202203 await keyRight ( this . browser ) ;
203204
204205 chai . assert . equal ( await getCurrentFocusedBlockId ( this . browser ) , 'text_1' ) ;
@@ -246,7 +247,7 @@ suite('Keyboard navigation on Fields', function () {
246247
247248 test ( 'Up from first field selects block' , async function ( ) {
248249 await focusOnBlockField ( this . browser , 'p5_canvas_1' , 'WIDTH' ) ;
249- await this . browser . pause ( PAUSE_TIME ) ;
250+ await idle ( this . browser ) ;
250251 await keyUp ( this . browser ) ;
251252
252253 chai . assert . equal (
@@ -257,7 +258,7 @@ suite('Keyboard navigation on Fields', function () {
257258
258259 test ( 'Left from first field selects block' , async function ( ) {
259260 await focusOnBlockField ( this . browser , 'p5_canvas_1' , 'WIDTH' ) ;
260- await this . browser . pause ( PAUSE_TIME ) ;
261+ await idle ( this . browser ) ;
261262 await keyLeft ( this . browser ) ;
262263
263264 chai . assert . equal (
@@ -268,7 +269,7 @@ suite('Keyboard navigation on Fields', function () {
268269
269270 test ( 'Right from first field selects second field' , async function ( ) {
270271 await focusOnBlockField ( this . browser , 'p5_canvas_1' , 'WIDTH' ) ;
271- await this . browser . pause ( PAUSE_TIME ) ;
272+ await idle ( this . browser ) ;
272273 await keyRight ( this . browser ) ;
273274
274275 chai
@@ -280,7 +281,7 @@ suite('Keyboard navigation on Fields', function () {
280281
281282 test ( 'Left from second field selects first field' , async function ( ) {
282283 await focusOnBlockField ( this . browser , 'p5_canvas_1' , 'HEIGHT' ) ;
283- await this . browser . pause ( PAUSE_TIME ) ;
284+ await idle ( this . browser ) ;
284285 await keyLeft ( this . browser ) ;
285286
286287 chai
@@ -292,7 +293,7 @@ suite('Keyboard navigation on Fields', function () {
292293
293294 test ( 'Right from second field selects next block' , async function ( ) {
294295 await focusOnBlockField ( this . browser , 'p5_canvas_1' , 'HEIGHT' ) ;
295- await this . browser . pause ( PAUSE_TIME ) ;
296+ await idle ( this . browser ) ;
296297 await keyRight ( this . browser ) ;
297298
298299 chai
@@ -302,7 +303,7 @@ suite('Keyboard navigation on Fields', function () {
302303
303304 test ( 'Down from field selects next block' , async function ( ) {
304305 await focusOnBlockField ( this . browser , 'p5_canvas_1' , 'WIDTH' ) ;
305- await this . browser . pause ( PAUSE_TIME ) ;
306+ await idle ( this . browser ) ;
306307 await keyDown ( this . browser ) ;
307308
308309 chai
@@ -312,7 +313,7 @@ suite('Keyboard navigation on Fields', function () {
312313
313314 test ( "Down from field selects block's child block" , async function ( ) {
314315 await focusOnBlockField ( this . browser , 'controls_repeat_1' , 'TIMES' ) ;
315- await this . browser . pause ( PAUSE_TIME ) ;
316+ await idle ( this . browser ) ;
316317 await keyDown ( this . browser ) ;
317318
318319 chai
@@ -323,7 +324,7 @@ suite('Keyboard navigation on Fields', function () {
323324 test ( 'Do not navigate while field editor is open' , async function ( ) {
324325 // Open a field editor dropdown
325326 await focusOnBlockField ( this . browser , 'logic_boolean_1' , 'BOOL' ) ;
326- await this . browser . pause ( PAUSE_TIME ) ;
327+ await idle ( this . browser ) ;
327328 await sendKeyAndWait ( this . browser , Key . Enter ) ;
328329
329330 // Try to navigate to a different block
@@ -336,7 +337,7 @@ suite('Keyboard navigation on Fields', function () {
336337 test ( 'Do not reopen field editor when handling enter to make a choice inside the editor' , async function ( ) {
337338 // Open colour picker
338339 await focusOnBlockField ( this . browser , 'colour_picker_1' , 'COLOUR' ) ;
339- await this . browser . pause ( PAUSE_TIME ) ;
340+ await idle ( this . browser ) ;
340341 await sendKeyAndWait ( this . browser , Key . Enter ) ;
341342
342343 // Move right to pick a new colour.
0 commit comments