mirror of https://github.com/coder/code-server.git
refactor: fix tests to check visibility correctly
This commit is contained in:
parent
2665a4f61b
commit
2bf0a0e76e
|
@ -20,6 +20,6 @@ test.describe("globalSetup", () => {
|
||||||
test("should keep us logged in using the storageState", options, async ({ page }) => {
|
test("should keep us logged in using the storageState", options, async ({ page }) => {
|
||||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||||
// Make sure the editor actually loaded
|
// Make sure the editor actually loaded
|
||||||
expect(await page.isVisible("div.monaco-workbench"))
|
expect(await page.isVisible("div.monaco-workbench")).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -24,7 +24,7 @@ test.describe("login", () => {
|
||||||
await page.click(".submit")
|
await page.click(".submit")
|
||||||
await page.waitForLoadState("networkidle")
|
await page.waitForLoadState("networkidle")
|
||||||
// Make sure the editor actually loaded
|
// Make sure the editor actually loaded
|
||||||
expect(await page.isVisible("div.monaco-workbench"))
|
expect(await page.isVisible("div.monaco-workbench")).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("should see an error message for missing password", options, async ({ page }) => {
|
test("should see an error message for missing password", options, async ({ page }) => {
|
||||||
|
|
|
@ -17,14 +17,14 @@ test.describe("logout", () => {
|
||||||
await page.click(".submit")
|
await page.click(".submit")
|
||||||
await page.waitForLoadState("networkidle")
|
await page.waitForLoadState("networkidle")
|
||||||
// Make sure the editor actually loaded
|
// Make sure the editor actually loaded
|
||||||
expect(await page.isVisible("div.monaco-workbench"))
|
expect(await page.isVisible("div.monaco-workbench")).toBe(true)
|
||||||
|
|
||||||
// Click the Application menu
|
// Click the Application menu
|
||||||
await page.click("[aria-label='Application Menu']")
|
await page.click("[aria-label='Application Menu']")
|
||||||
|
|
||||||
// See the Log out button
|
// See the Log out button
|
||||||
const logoutButton = "a.action-menu-item span[aria-label='Log out']"
|
const logoutButton = "a.action-menu-item span[aria-label='Log out']"
|
||||||
expect(await page.isVisible(logoutButton))
|
expect(await page.isVisible(logoutButton)).toBe(true)
|
||||||
|
|
||||||
await page.hover(logoutButton)
|
await page.hover(logoutButton)
|
||||||
// TODO(@jsjoeio)
|
// TODO(@jsjoeio)
|
||||||
|
|
|
@ -21,26 +21,26 @@ test.describe("Open Help > About", () => {
|
||||||
async ({ page }) => {
|
async ({ page }) => {
|
||||||
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
||||||
// Make sure the editor actually loaded
|
// Make sure the editor actually loaded
|
||||||
expect(await page.isVisible("div.monaco-workbench"))
|
expect(await page.isVisible("div.monaco-workbench")).toBe(true)
|
||||||
|
|
||||||
// Click the Application menu
|
// Click the Application menu
|
||||||
await page.click("[aria-label='Application Menu']")
|
await page.click("[aria-label='Application Menu']")
|
||||||
// See the Help button
|
// See the Help button
|
||||||
const helpButton = "a.action-menu-item span[aria-label='Help']"
|
const helpButton = "a.action-menu-item span[aria-label='Help']"
|
||||||
expect(await page.isVisible(helpButton))
|
expect(await page.isVisible(helpButton)).toBe(true)
|
||||||
|
|
||||||
// Hover the helpButton
|
// Hover the helpButton
|
||||||
await page.hover(helpButton)
|
await page.hover(helpButton)
|
||||||
|
|
||||||
// see the About button and click it
|
// see the About button and click it
|
||||||
const aboutButton = "a.action-menu-item span[aria-label='About']"
|
const aboutButton = "a.action-menu-item span[aria-label='About']"
|
||||||
expect(await page.isVisible(aboutButton))
|
expect(await page.isVisible(aboutButton)).toBe(true)
|
||||||
// NOTE: it won't work unless you hover it first
|
// NOTE: it won't work unless you hover it first
|
||||||
await page.hover(aboutButton)
|
await page.hover(aboutButton)
|
||||||
await page.click(aboutButton)
|
await page.click(aboutButton)
|
||||||
|
|
||||||
const codeServerText = "text=code-server"
|
const codeServerText = "text=code-server"
|
||||||
expect(await page.isVisible(codeServerText))
|
expect(await page.isVisible(codeServerText)).toBe(true)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue