@@ -177,6 +177,8 @@ export class CodeServerPage {
177
177
* Reload until both checks pass
178
178
*/
179
179
async reloadUntilEditorIsReady ( ) {
180
+ this . codeServer . logger . debug ( "Waiting for editor to be ready..." )
181
+
180
182
const editorIsVisible = await this . isEditorVisible ( )
181
183
const editorIsConnected = await this . isConnected ( )
182
184
let reloadCount = 0
@@ -199,25 +201,36 @@ export class CodeServerPage {
199
201
}
200
202
await this . page . reload ( )
201
203
}
204
+
205
+ this . codeServer . logger . debug ( "Editor is ready!" )
202
206
}
203
207
204
208
/**
205
209
* Checks if the editor is visible
206
210
*/
207
211
async isEditorVisible ( ) {
212
+ this . codeServer . logger . debug ( "Waiting for editor to be visible..." )
208
213
// Make sure the editor actually loaded
209
214
await this . page . waitForSelector ( this . editorSelector )
210
- return await this . page . isVisible ( this . editorSelector )
215
+ const visible = await this . page . isVisible ( this . editorSelector )
216
+
217
+ this . codeServer . logger . debug ( `Editor is ${ visible ? "not visible" : "visible" } !` )
218
+
219
+ return visible
211
220
}
212
221
213
222
/**
214
223
* Checks if the editor is visible
215
224
*/
216
225
async isConnected ( ) {
226
+ this . codeServer . logger . debug ( "Waiting for network idle..." )
227
+
217
228
await this . page . waitForLoadState ( "networkidle" )
218
229
219
230
const host = new URL ( await this . codeServer . address ( ) ) . host
220
- const hostSelector = `[title="Editing on ${ host } "]`
231
+ // NOTE: This seems to be pretty brittle between version changes.
232
+ const hostSelector = `[aria-label="remote ${ host } "]`
233
+ this . codeServer . logger . debug ( `Waiting selector: ${ hostSelector } ` )
221
234
await this . page . waitForSelector ( hostSelector )
222
235
223
236
return await this . page . isVisible ( hostSelector )
0 commit comments