From 51010e73cb0c39efe06a4e44afd0a41c9e92526d Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 1 Apr 2021 11:48:23 -0700 Subject: [PATCH] feat: add test for globalSetup --- test/e2e/globalSetup.test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/e2e/globalSetup.test.ts diff --git a/test/e2e/globalSetup.test.ts b/test/e2e/globalSetup.test.ts new file mode 100644 index 00000000..cfbe512b --- /dev/null +++ b/test/e2e/globalSetup.test.ts @@ -0,0 +1,22 @@ +/// +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 +describe("globalSetup", () => { + beforeEach(async () => { + // Create a new context with the saved storage state + const storageState = JSON.parse(STORAGE) || {} + console.log("what is storage ", storageState) + await jestPlaywright.resetContext({ storageState }) + await page.goto(CODE_SERVER_ADDRESS) + // code-server takes a second to load + await page.waitForTimeout(1000) + }) + + it("should keep us logged in if we don't reset the browser", async () => { + // See the editor + const codeServerEditor = await page.isVisible(".monaco-workbench") + expect(codeServerEditor).toBeTruthy() + }) +})