提交 7f2b1dcd 编写于 作者: T Teffen Ellis 提交者: Teffen Ellis

Fix outdated selector. Add debug info.

上级 c861a1d7
......@@ -8,7 +8,7 @@ describe("browser", true, () => {
firefox: "Firefox",
webkit: "Safari",
}
const userAgent = await codeServerPage.page.evaluate("navigator.userAgent")
const userAgent = await codeServerPage.page.evaluate(() => navigator.userAgent)
expect(userAgent).toContain(displayNames[browserName])
})
......
......@@ -177,6 +177,8 @@ export class CodeServerPage {
* Reload until both checks pass
*/
async reloadUntilEditorIsReady() {
this.codeServer.logger.debug("Waiting for editor to be ready...")
const editorIsVisible = await this.isEditorVisible()
const editorIsConnected = await this.isConnected()
let reloadCount = 0
......@@ -199,25 +201,36 @@ export class CodeServerPage {
}
await this.page.reload()
}
this.codeServer.logger.debug("Editor is ready!")
}
/**
* Checks if the editor is visible
*/
async isEditorVisible() {
this.codeServer.logger.debug("Waiting for editor to be visible...")
// Make sure the editor actually loaded
await this.page.waitForSelector(this.editorSelector)
return await this.page.isVisible(this.editorSelector)
const visible = await this.page.isVisible(this.editorSelector)
this.codeServer.logger.debug(`Editor is ${visible ? "not visible" : "visible"}!`)
return visible
}
/**
* Checks if the editor is visible
*/
async isConnected() {
this.codeServer.logger.debug("Waiting for network idle...")
await this.page.waitForLoadState("networkidle")
const host = new URL(await this.codeServer.address()).host
const hostSelector = `[title="Editing on ${host}"]`
// NOTE: This seems to be pretty brittle between version changes.
const hostSelector = `[aria-label="remote ${host}"]`
this.codeServer.logger.debug(`Waiting selector: ${hostSelector}`)
await this.page.waitForSelector(hostSelector)
return await this.page.isVisible(hostSelector)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册