Skip to content

Commit 565dbec

Browse files
committed
Fix outdated selector. Add debug info.
1 parent d4dafd8 commit 565dbec

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

test/e2e/browser.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("browser", true, () => {
88
firefox: "Firefox",
99
webkit: "Safari",
1010
}
11-
const userAgent = await codeServerPage.page.evaluate("navigator.userAgent")
11+
const userAgent = await codeServerPage.page.evaluate(() => navigator.userAgent)
1212

1313
expect(userAgent).toContain(displayNames[browserName])
1414
})

test/e2e/models/CodeServer.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ export class CodeServerPage {
177177
* Reload until both checks pass
178178
*/
179179
async reloadUntilEditorIsReady() {
180+
this.codeServer.logger.debug("Waiting for editor to be ready...")
181+
180182
const editorIsVisible = await this.isEditorVisible()
181183
const editorIsConnected = await this.isConnected()
182184
let reloadCount = 0
@@ -199,25 +201,36 @@ export class CodeServerPage {
199201
}
200202
await this.page.reload()
201203
}
204+
205+
this.codeServer.logger.debug("Editor is ready!")
202206
}
203207

204208
/**
205209
* Checks if the editor is visible
206210
*/
207211
async isEditorVisible() {
212+
this.codeServer.logger.debug("Waiting for editor to be visible...")
208213
// Make sure the editor actually loaded
209214
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
211220
}
212221

213222
/**
214223
* Checks if the editor is visible
215224
*/
216225
async isConnected() {
226+
this.codeServer.logger.debug("Waiting for network idle...")
227+
217228
await this.page.waitForLoadState("networkidle")
218229

219230
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}`)
221234
await this.page.waitForSelector(hostSelector)
222235

223236
return await this.page.isVisible(hostSelector)

0 commit comments

Comments
 (0)