refactor: globalSetup and create cookie manually

This commit is contained in:
Joe Previte
2021-04-01 14:52:46 -07:00
parent 51010e73cb
commit c666b47668
7 changed files with 33 additions and 77 deletions

View File

@@ -3,8 +3,8 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
describe("login", () => {
beforeEach(async () => {
await jestPlaywright.resetContext()
await page.goto(CODE_SERVER_ADDRESS)
await jestPlaywright.resetBrowser()
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
})
it("should be able to login", async () => {
@@ -12,9 +12,7 @@ describe("login", () => {
await page.fill(".password", PASSWORD)
// Click the submit button and login
await page.click(".submit")
// For some reason, it wasn't waiting for the click and navigation before checking
// so adding a timeout ensures that we allow the editor time to load
await page.waitForTimeout(1000)
await page.waitForLoadState("networkidle")
// See the editor
const codeServerEditor = await page.isVisible(".monaco-workbench")
expect(codeServerEditor).toBeTruthy()