code-server/test/e2e/openHelpAbout.test.ts

47 lines
1.4 KiB
TypeScript
Raw Normal View History

import { test, expect } from "@playwright/test"
import { STORAGE } from "../utils/constants"
import { CodeServer } from "./models/CodeServer"
2021-03-17 05:43:29 +08:00
test.describe("Open Help > About", () => {
2021-04-15 03:01:17 +08:00
// Create a new context with the saved storage state
// so we don't have to logged in
const options: any = {}
let codeServer: CodeServer
2021-04-15 03:01:17 +08:00
// TODO@jsjoeio
// Fix this once https://github.com/microsoft/playwright-test/issues/240
// is fixed
if (STORAGE) {
2021-03-17 05:43:29 +08:00
const storageState = JSON.parse(STORAGE) || {}
2021-04-15 03:01:17 +08:00
options.contextOptions = {
storageState,
}
}
2021-03-17 05:43:29 +08:00
test.beforeEach(async ({ page }) => {
codeServer = new CodeServer(page)
await codeServer.setup()
})
2021-04-15 03:01:17 +08:00
test(
"should see a 'Help' then 'About' button in the Application Menu that opens a dialog",
options,
async ({ page }) => {
// Open using the manu
// Click [aria-label="Application Menu"] div[role="none"]
await page.click('[aria-label="Application Menu"] div[role="none"]')
2021-03-17 05:43:29 +08:00
// Click the Help button
await page.hover("text=Help")
await page.click("text=Help")
2021-03-17 05:43:29 +08:00
// Click the About button
await page.hover("text=About")
await page.click("text=About")
2021-03-17 05:43:29 +08:00
// Click div[role="dialog"] >> text=code-server
const element = await page.waitForSelector('div[role="dialog"] >> text=code-server')
expect(element).not.toBeNull()
2021-04-15 03:01:17 +08:00
},
)
2021-03-17 05:43:29 +08:00
})