fix(portal): redirect unauthenticated users to login — never show portal chrome (GRO-309) #191
@@ -2,7 +2,6 @@ import { test, expect } from "./fixtures.js";
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* E2E tests for customer portal impersonation flow.
|
* E2E tests for customer portal impersonation flow.
|
||||||
* Tests ImpersonationBanner display, actions, and session management.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const MOCK_SESSION = {
|
const MOCK_SESSION = {
|
||||||
@@ -19,7 +18,7 @@ const MOCK_SESSION = {
|
|||||||
|
|
||||||
test.describe("ImpersonationBanner", () => {
|
test.describe("ImpersonationBanner", () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// Impersonation session endpoints
|
// Only mock impersonation endpoints - portal/me is NOT called in impersonation flow
|
||||||
await page.route("**/api/impersonation/sessions/session-1", (route) =>
|
await page.route("**/api/impersonation/sessions/session-1", (route) =>
|
||||||
route.fulfill({ json: MOCK_SESSION })
|
route.fulfill({ json: MOCK_SESSION })
|
||||||
);
|
);
|
||||||
@@ -32,10 +31,8 @@ test.describe("ImpersonationBanner", () => {
|
|||||||
await page.route("**/api/impersonation/sessions/session-1/audit-log", (route) =>
|
await page.route("**/api/impersonation/sessions/session-1/audit-log", (route) =>
|
||||||
route.fulfill({ json: { logs: [] } })
|
route.fulfill({ json: { logs: [] } })
|
||||||
);
|
);
|
||||||
// Portal profile endpoint used during impersonation
|
// NOTE: NOT mocking portal/me - this endpoint is only called in the CLIENT
|
||||||
await page.route("**/api/portal/me**", (route) =>
|
// dev user flow (devUser.type === "client"), NOT in the impersonation flow
|
||||||
route.fulfill({ json: { id: "client-1", name: "Carol Client", email: "carol@test.com" } })
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("banner displays when session is active", async ({ page }) => {
|
test("banner displays when session is active", async ({ page }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user