Wait for logout response before verifying sign-out

The link-action handler does an async fetch POST then a form-based
redirect chain which can be slow on CI. Wait for the /user/logout
response to confirm session destruction, then navigate to verify.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
silverwind
2026-02-18 03:03:15 +01:00
co-authored by Claude Opus 4.6
parent 5354352bee
commit 20f96f7c1b
+6 -1
View File
@@ -17,6 +17,11 @@ export async function login(page: Page) {
export async function logout(page: Page) {
const navbar = page.getByRole('navigation', {name: 'Navigation Bar'});
await clickDropdownItem(page, navbar.getByTitle(env.E2E_USER!), 'Sign Out');
await navbar.getByTitle(env.E2E_USER!).click();
await Promise.all([
page.waitForResponse((resp) => resp.url().includes('/user/logout')),
page.getByText('Sign Out').click(),
]);
await page.goto('/');
await expect(page.getByRole('link', {name: 'Sign In'})).toBeVisible();
}