Skip to content

Commit 806022a

Browse files
committed
refactor: waitforNavigation in logout test
1 parent 46dc0fc commit 806022a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/e2e/logout.test.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ describe("logout", () => {
4646

4747
await page.hover(logoutButton)
4848

49-
await Promise.all([page.waitForNavigation(), page.click(logoutButton)])
50-
51-
const currentUrl = await page.url()
49+
await page.click(logoutButton)
50+
// it takes a second to navigate
51+
// and since page.url comes back immediately
52+
// we need this waitForNavigation, otherwise it will check
53+
// before navigation has finished and fail
54+
await page.waitForNavigation({ url: `${CODE_SERVER_ADDRESS}/login` })
55+
const currentUrl = page.url()
5256
expect(currentUrl).toBe(`${CODE_SERVER_ADDRESS}/login`)
5357
})
5458
})

0 commit comments

Comments
 (0)