diff --git a/apps/web/e2e/full-sweep-auth.spec.ts b/apps/web/e2e/full-sweep-auth.spec.ts index 5dea285..219912a 100644 --- a/apps/web/e2e/full-sweep-auth.spec.ts +++ b/apps/web/e2e/full-sweep-auth.spec.ts @@ -110,6 +110,16 @@ async function fulfillConfig(page: Page, body: unknown) { }); } +async function mockUnauthenticatedMe(page: Page) { + await page.route(ME_PATTERN, async (route) => { + await route.fulfill({ + status: 401, + contentType: "application/json", + body: JSON.stringify({ detail: "not_authenticated" }), + }); + }); +} + test.describe("full sweep auth", () => { test.beforeEach(async ({ page }) => { await useRealApi(page); @@ -119,13 +129,7 @@ test.describe("full sweep auth", () => { test("login root follows the narrow document scrollport without horizontal overflow", async ({ page, }) => { - await page.route(ME_PATTERN, async (route) => { - await route.fulfill({ - status: 401, - contentType: "application/json", - body: JSON.stringify({ detail: "not_authenticated" }), - }); - }); + await mockUnauthenticatedMe(page); await fulfillConfig(page, READY_AUTH_CONFIG); await page.setViewportSize({ width: 390, height: 844 }); await page.goto("/login"); @@ -152,13 +156,7 @@ test.describe("full sweep auth", () => { test("secondary Google button shows the second allowed domain and starts the same google OAuth flow", async ({ page, }) => { - await page.route(ME_PATTERN, async (route) => { - await route.fulfill({ - status: 401, - contentType: "application/json", - body: JSON.stringify({ detail: "not_authenticated" }), - }); - }); + await mockUnauthenticatedMe(page); await fulfillConfig(page, READY_AUTH_CONFIG); await page.route("**/api/auth/login**", async (route) => { await route.fulfill({ @@ -194,6 +192,7 @@ test.describe("full sweep auth", () => { test("brand panel domain badges distinguish checking, unset, and loaded states", async ({ page, }) => { + await mockUnauthenticatedMe(page); // 1) 설정 조회가 끝나지 않은 동안: "확인 중" 배지. await page.route(CONFIG_PATTERN, () => { /* 응답을 보류해 조회 중 상태를 고정한다 */