Archived
1
0

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,17 +3,16 @@ import { CODE_SERVER_ADDRESS, PASSWORD } from "../utils/constants"
describe("logout", () => {
beforeEach(async () => {
await jestPlaywright.resetContext()
await jestPlaywright.resetBrowser()
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
})
it("should be able login and logout", async () => {
await page.goto(CODE_SERVER_ADDRESS)
// Type in password
await page.fill(".password", PASSWORD)
// Click the submit button and login
await page.click(".submit")
// Allow time to navigate
await page.waitForTimeout(1000)
await page.waitForLoadState("networkidle")
// See the editor
const codeServerEditor = await page.isVisible(".monaco-workbench")
expect(codeServerEditor).toBeTruthy()
@ -28,8 +27,8 @@ describe("logout", () => {
await page.hover(logoutButton)
await page.click(logoutButton)
// it takes a couple seconds to navigate
await page.waitForTimeout(2000)
// it takes a couple seconds for url to change
await page.waitForLoadState("networkidle")
const currentUrl = page.url()
expect(currentUrl).toBe(`${CODE_SERVER_ADDRESS}/login`)
})