@@ -11,6 +11,7 @@ const driver = new Builder()
11
11
12
12
const baseUrl = "http://localhost:8080" ;
13
13
const password = "739f75e86e8d7843df146bac" ;
14
+ const clickTries = 5 ;
14
15
15
16
let login = async function ( ) {
16
17
let loginContainer = By . css ( '.login-form' ) ;
@@ -196,8 +197,24 @@ async function performCommand(cmd) {
196
197
}
197
198
198
199
async function clickStepInto ( ) {
199
- let stepIntoButton = await driver . wait ( until . elementLocated ( By . css ( ".codicon-debug-step-into" ) ) ) ;
200
- await stepIntoButton . click ( ) ;
200
+ let clicked = false ;
201
+
202
+ // Try a number of times to click the step into button. We sometimes get a stale reference here
203
+ // because the UI is refreshed async. We'll try a few times before concluding that something
204
+ // went wrong.
205
+ for ( var i = 0 ; ! clicked && i < clickTries ; i ++ ) {
206
+ let stepIntoButton = await driver . wait ( until . elementLocated ( By . css ( ".codicon-debug-step-into" ) ) ) ;
207
+ try {
208
+ // This reference could be stale due to asynchronous action in the browser.
209
+ await stepIntoButton . click ( ) ;
210
+ clicked = true ;
211
+ } catch ( e ) {
212
+ console . log ( `Stale reference error clicking step into, trying again ${ i } /${ clickTries } ` ) ;
213
+ }
214
+ }
215
+ if ( ! clicked ) {
216
+ throw new Exception ( 'Too many tries to click advance without success' ) ;
217
+ }
201
218
await wait ( 1.0 ) ;
202
219
}
203
220
@@ -384,13 +401,12 @@ describe("Basic element tests", function() {
384
401
385
402
// Pgup right 7 space QQEX C-f defun-inline C-f logand right 6 Q
386
403
// find a monaco-list-rows with a descendant that contains QQEX.
387
- await sendPgUp ( ) ;
388
- await sendRight ( 7 ) ;
404
+ await findString ( driver , 'two three' ) ;
405
+ await sendRight ( 1 ) ;
389
406
await sendString ( " QQEX" ) ;
390
407
391
- await findString ( driver , 'defun-inline' ) ;
392
- await findString ( driver , 'logand' ) ;
393
- await sendRight ( 5 ) ;
408
+ await findString ( driver , '(odd X' ) ;
409
+ await sendRight ( 1 ) ;
394
410
await sendString ( " Q" ) ;
395
411
396
412
let monacoLists = await driver . findElements ( By . css ( ".monaco-list" ) ) ;
0 commit comments