chore: upgrade to Playwright 1.12 with its new test-runner
This commit is contained in:
@ -1,49 +1,32 @@
|
||||
import { test, expect } from "@playwright/test"
|
||||
import { CODE_SERVER_ADDRESS, STORAGE } from "../utils/constants"
|
||||
import { CodeServer } from "./models/CodeServer"
|
||||
import { CODE_SERVER_ADDRESS, storageState } from "../utils/constants"
|
||||
import { test, expect } from "./baseFixture"
|
||||
|
||||
test.describe("CodeServer", () => {
|
||||
// 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 navigate to ${CODE_SERVER_ADDRESS}`, options, async ({ page }) => {
|
||||
test(`should navigate to ${CODE_SERVER_ADDRESS}`, async ({ codeServerPage }) => {
|
||||
// We navigate codeServer before each test
|
||||
// and we start the test with a storage state
|
||||
// which means we should be logged in
|
||||
// so it should be on the address
|
||||
const url = page.url()
|
||||
const url = codeServerPage.page.url()
|
||||
// We use match because there may be a / at the end
|
||||
// so we don't want it to fail if we expect http://localhost:8080 to match http://localhost:8080/
|
||||
expect(url).toMatch(CODE_SERVER_ADDRESS)
|
||||
})
|
||||
|
||||
test("should always see the code-server editor", options, async ({ page }) => {
|
||||
expect(await codeServer.isEditorVisible()).toBe(true)
|
||||
test("should always see the code-server editor", async ({ codeServerPage }) => {
|
||||
expect(await codeServerPage.isEditorVisible()).toBe(true)
|
||||
})
|
||||
|
||||
test("should always have a connection", options, async ({ page }) => {
|
||||
expect(await codeServer.isConnected()).toBe(true)
|
||||
test("should always have a connection", async ({ codeServerPage }) => {
|
||||
expect(await codeServerPage.isConnected()).toBe(true)
|
||||
})
|
||||
|
||||
test("should show the Integrated Terminal", options, async ({ page }) => {
|
||||
await codeServer.focusTerminal()
|
||||
expect(await page.isVisible("#terminal")).toBe(true)
|
||||
test("should show the Integrated Terminal", async ({ codeServerPage }) => {
|
||||
await codeServerPage.focusTerminal()
|
||||
expect(await codeServerPage.page.isVisible("#terminal")).toBe(true)
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user