2021-04-13 21:02:52 +02:00
|
|
|
import { test, expect } from "@playwright/test"
|
2021-04-01 23:52:46 +02:00
|
|
|
import { CODE_SERVER_ADDRESS, STORAGE } from "../utils/constants"
|
2021-03-16 22:43:29 +01:00
|
|
|
|
2021-04-13 21:02:52 +02:00
|
|
|
test.describe("Open Help > About", () => {
|
2021-04-14 21:01:17 +02:00
|
|
|
// Create a new context with the saved storage state
|
|
|
|
// so we don't have to logged in
|
|
|
|
const options: any = {}
|
|
|
|
// TODO@jsjoeio
|
|
|
|
// Fix this once https://github.com/microsoft/playwright-test/issues/240
|
|
|
|
// is fixed
|
|
|
|
if (STORAGE) {
|
2021-03-16 22:43:29 +01:00
|
|
|
const storageState = JSON.parse(STORAGE) || {}
|
2021-04-14 21:01:17 +02:00
|
|
|
options.contextOptions = {
|
|
|
|
storageState,
|
|
|
|
}
|
|
|
|
}
|
2021-03-16 22:43:29 +01:00
|
|
|
|
2021-04-14 21:01:17 +02:00
|
|
|
test(
|
|
|
|
"should see a 'Help' then 'About' button in the Application Menu that opens a dialog",
|
|
|
|
options,
|
|
|
|
async ({ page }) => {
|
|
|
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
|
|
|
// Make sure the editor actually loaded
|
2021-04-20 19:48:17 +02:00
|
|
|
expect(await page.isVisible("div.monaco-workbench")).toBe(true)
|
2021-03-16 22:43:29 +01:00
|
|
|
|
2021-04-14 21:01:17 +02:00
|
|
|
// Click the Application menu
|
|
|
|
await page.click("[aria-label='Application Menu']")
|
|
|
|
// See the Help button
|
|
|
|
const helpButton = "a.action-menu-item span[aria-label='Help']"
|
2021-04-20 19:48:17 +02:00
|
|
|
expect(await page.isVisible(helpButton)).toBe(true)
|
2021-03-16 22:43:29 +01:00
|
|
|
|
2021-04-14 21:01:17 +02:00
|
|
|
// Hover the helpButton
|
|
|
|
await page.hover(helpButton)
|
2021-03-16 22:43:29 +01:00
|
|
|
|
2021-04-14 21:01:17 +02:00
|
|
|
// see the About button and click it
|
|
|
|
const aboutButton = "a.action-menu-item span[aria-label='About']"
|
2021-04-20 19:48:17 +02:00
|
|
|
expect(await page.isVisible(aboutButton)).toBe(true)
|
2021-04-14 21:01:17 +02:00
|
|
|
// NOTE: it won't work unless you hover it first
|
|
|
|
await page.hover(aboutButton)
|
|
|
|
await page.click(aboutButton)
|
2021-03-16 22:43:29 +01:00
|
|
|
|
2021-04-14 21:01:17 +02:00
|
|
|
const codeServerText = "text=code-server"
|
2021-04-20 19:48:17 +02:00
|
|
|
expect(await page.isVisible(codeServerText)).toBe(true)
|
2021-04-14 21:01:17 +02:00
|
|
|
},
|
|
|
|
)
|
2021-03-16 22:43:29 +01:00
|
|
|
})
|