1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-26 20:25:25 +00:00
code-server-2/test/e2e/globalSetup.test.ts
2021-04-23 14:35:33 -07:00

31 lines
1002 B
TypeScript

import { test, expect } from "@playwright/test"
import { STORAGE } from "../utils/constants"
import { CodeServer } from "./models/CodeServer"
// This test is to make sure the globalSetup works as expected
// meaning globalSetup ran and stored the storageState in STORAGE
test.describe("globalSetup", () => {
// 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("should keep us logged in using the storageState", options, async ({ page }) => {
// Make sure the editor actually loaded
expect(await codeServer.isEditorVisible()).toBe(true)
})
})