refactor: logout test
This commit is contained in:
@ -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()
|
||||
|
@ -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`)
|
||||
})
|
||||
|
Reference in New Issue
Block a user