dev1/tests/e2e/14-session-expired-handler.spec.mjs

22 lines
766 B
JavaScript

// @ts-check
import { test, expect } from '@playwright/test';
test.describe('@p0 SessionExpiredHandler', () => {
test.setTimeout(15000);
test('unauth → protected route → /signin?session=expired + banner', async ({ page }) => {
await page.context().clearCookies();
// Hit a protected route with no session
await page.goto('/career-explorer', { waitUntil: 'networkidle' });
// App code: navigate('/signin?session=expired', { replace: true })
await expect(page).toHaveURL(/\/signin\?session=expired$/i, { timeout: 8000 });
// SignIn banner: "Your session has expired. Please sign in again."
await expect(
page.getByText(/Your session has expired\. Please sign in again\./i)
).toBeVisible({ timeout: 5000 });
});
});