Archived
1
0

chore: upgrade to Playwright 1.12 with its new test-runner

This commit is contained in:
Max Schmitt
2021-06-10 15:09:38 +02:00
parent 9fc9c041ad
commit dbb34ad710
17 changed files with 482 additions and 1043 deletions

View File

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