2021-04-13 19:02:52 +00:00
|
|
|
import { test, expect } from "@playwright/test"
|
2021-04-01 18:48:23 +00:00
|
|
|
import { CODE_SERVER_ADDRESS, STORAGE } from "../utils/constants"
|
|
|
|
|
|
|
|
// This test is to make sure the globalSetup works as expected
|
|
|
|
// meaning globalSetup ran and stored the storageState in STORAGE
|
2021-04-13 19:02:52 +00:00
|
|
|
test.describe("globalSetup", () => {
|
|
|
|
// Create a new context with the saved storage state
|
|
|
|
// so we don't have to logged in
|
2021-04-14 00:15:07 +00:00
|
|
|
const options: any = {}
|
|
|
|
|
|
|
|
// TODO@jsjoeio
|
|
|
|
// Fix this once https://github.com/microsoft/playwright-test/issues/240
|
|
|
|
// is fixed
|
|
|
|
if (STORAGE) {
|
|
|
|
const storageState = JSON.parse(STORAGE) || {}
|
|
|
|
options.contextOptions = {
|
2021-04-02 23:49:01 +00:00
|
|
|
storageState,
|
2021-04-14 00:15:07 +00:00
|
|
|
}
|
2021-04-13 19:02:52 +00:00
|
|
|
}
|
|
|
|
test("should keep us logged in using the storageState", options, async ({ page }) => {
|
2021-04-01 21:52:46 +00:00
|
|
|
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
|
2021-04-05 22:18:13 +00:00
|
|
|
// Make sure the editor actually loaded
|
2021-04-20 17:48:17 +00:00
|
|
|
expect(await page.isVisible("div.monaco-workbench")).toBe(true)
|
2021-04-01 18:48:23 +00:00
|
|
|
})
|
|
|
|
})
|