Archived
1
0

refactor: logout test

This commit is contained in:
Joe Previte
2021-04-02 12:32:24 -07:00
parent c666b47668
commit fd69f2db88
4 changed files with 11 additions and 98 deletions

View File

@ -12,7 +12,7 @@ describe("globalSetup", () => {
await page.goto(CODE_SERVER_ADDRESS, { waitUntil: "networkidle" })
})
it("should keep us logged in if we don't reset the browser", async () => {
it("should keep us logged in using the storageState", async () => {
// See the editor
const codeServerEditor = await page.isVisible(".monaco-workbench")
expect(codeServerEditor).toBeTruthy()

View File

@ -25,10 +25,16 @@ describe("logout", () => {
expect(await page.isVisible(logoutButton))
await page.hover(logoutButton)
// TODO(@jsjoeio)
// Look into how we're attaching the handlers for the logout feature
// We need to see how it's done upstream and add logging to the
// handlers themselves.
// They may be attached too slowly, hence why we need this timeout
await page.waitForTimeout(2000)
await page.click(logoutButton)
// it takes a couple seconds for url to change
await page.waitForLoadState("networkidle")
// Recommended by Playwright for async navigation
// https://github.com/microsoft/playwright/issues/1987#issuecomment-620182151
await Promise.all([page.waitForNavigation(), page.click(logoutButton)])
const currentUrl = page.url()
expect(currentUrl).toBe(`${CODE_SERVER_ADDRESS}/login`)
})