2021-04-13 22:02:52 +03:00
|
|
|
import { test, expect } from "@playwright/test"
|
2021-04-22 00:31:15 +03:00
|
|
|
import { STORAGE } from "../utils/constants"
|
|
|
|
import { CodeServer } from "./models/CodeServer"
|
2021-03-17 00:43:29 +03:00
|
|
|
|
2021-04-13 22:02:52 +03:00
|
|
|
test.describe("Open Help > About", () => {
|
2021-04-14 22:01:17 +03:00
|
|
|
// Create a new context with the saved storage state
|
|
|
|
// so we don't have to logged in
|
|
|
|
const options: any = {}
|
2021-04-22 00:31:15 +03:00
|
|
|
let codeServer: CodeServer
|
2021-04-14 22:01:17 +03:00
|
|
|
// TODO@jsjoeio
|
|
|
|
// Fix this once https://github.com/microsoft/playwright-test/issues/240
|
|
|
|
// is fixed
|
|
|
|
if (STORAGE) {
|
2021-03-17 00:43:29 +03:00
|
|
|
const storageState = JSON.parse(STORAGE) || {}
|
2021-04-14 22:01:17 +03:00
|
|
|
options.contextOptions = {
|
|
|
|
storageState,
|
|
|
|
}
|
|
|
|
}
|
2021-03-17 00:43:29 +03:00
|
|
|
|
2021-04-22 00:31:15 +03:00
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
codeServer = new CodeServer(page)
|
|
|
|
await codeServer.setup()
|
|
|
|
})
|
|
|
|
|
2021-04-14 22:01:17 +03:00
|
|
|
test(
|
|
|
|
"should see a 'Help' then 'About' button in the Application Menu that opens a dialog",
|
|
|
|
options,
|
|
|
|
async ({ page }) => {
|
2021-04-22 00:31:15 +03:00
|
|
|
// 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 00:43:29 +03:00
|
|
|
|
2021-04-22 00:31:15 +03:00
|
|
|
// Click the Help button
|
|
|
|
await page.hover("text=Help")
|
|
|
|
await page.click("text=Help")
|
2021-03-17 00:43:29 +03:00
|
|
|
|
2021-04-22 00:31:15 +03:00
|
|
|
// Click the About button
|
|
|
|
await page.hover("text=About")
|
|
|
|
await page.click("text=About")
|
2021-03-17 00:43:29 +03:00
|
|
|
|
2021-04-22 00:31:15 +03: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-14 22:01:17 +03:00
|
|
|
},
|
|
|
|
)
|
2021-03-17 00:43:29 +03:00
|
|
|
})
|