File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,18 @@ export class TestingBehatBlockingService {
139139 this . unblock ( key ) ;
140140 }
141141
142+ /**
143+ * Adds a pending key to the array, and remove it after some time.
144+ *
145+ * @param milliseconds Number of milliseconds to wait before the key is removed.
146+ * @returns Promise resolved after the time has passed.
147+ */
148+ async wait ( milliseconds : number ) : Promise < void > {
149+ const key = this . block ( ) ;
150+ await CoreWait . wait ( milliseconds ) ;
151+ this . unblock ( key ) ;
152+ }
153+
142154 /**
143155 * It would be really beautiful if you could detect CSS transitions and animations, that would
144156 * cover almost everything, but sadly there is no way to do this because the transitionstart
Original file line number Diff line number Diff line change @@ -219,6 +219,9 @@ export class TestingBehatRuntimeService {
219219 // Click button
220220 await TestingBehatDomUtils . pressElement ( foundButton ) ;
221221
222+ // Block Behat for at least 500ms, WS calls or DOM changes might not begin immediately.
223+ TestingBehatBlocking . wait ( 500 ) ;
224+
222225 return 'OK' ;
223226 }
224227
@@ -446,6 +449,9 @@ export class TestingBehatRuntimeService {
446449
447450 await TestingBehatDomUtils . pressElement ( found ) ;
448451
452+ // Block Behat for at least 500ms, WS calls or DOM changes might not begin immediately.
453+ TestingBehatBlocking . wait ( 500 ) ;
454+
449455 return 'OK' ;
450456 } catch ( error ) {
451457 return 'ERROR: ' + error . message ;
You can’t perform that action at this time.
0 commit comments