인증 E2E 격리성 보강

This commit is contained in:
Yun Chan 2026-08-12 17:49:08 +09:00
parent 0b9da9ca15
commit f08e03de13

View file

@ -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.describe("full sweep auth", () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
await useRealApi(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 ({ test("login root follows the narrow document scrollport without horizontal overflow", async ({
page, page,
}) => { }) => {
await page.route(ME_PATTERN, async (route) => { await mockUnauthenticatedMe(page);
await route.fulfill({
status: 401,
contentType: "application/json",
body: JSON.stringify({ detail: "not_authenticated" }),
});
});
await fulfillConfig(page, READY_AUTH_CONFIG); await fulfillConfig(page, READY_AUTH_CONFIG);
await page.setViewportSize({ width: 390, height: 844 }); await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/login"); 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 ({ test("secondary Google button shows the second allowed domain and starts the same google OAuth flow", async ({
page, page,
}) => { }) => {
await page.route(ME_PATTERN, async (route) => { await mockUnauthenticatedMe(page);
await route.fulfill({
status: 401,
contentType: "application/json",
body: JSON.stringify({ detail: "not_authenticated" }),
});
});
await fulfillConfig(page, READY_AUTH_CONFIG); await fulfillConfig(page, READY_AUTH_CONFIG);
await page.route("**/api/auth/login**", async (route) => { await page.route("**/api/auth/login**", async (route) => {
await route.fulfill({ await route.fulfill({
@ -194,6 +192,7 @@ test.describe("full sweep auth", () => {
test("brand panel domain badges distinguish checking, unset, and loaded states", async ({ test("brand panel domain badges distinguish checking, unset, and loaded states", async ({
page, page,
}) => { }) => {
await mockUnauthenticatedMe(page);
// 1) 설정 조회가 끝나지 않은 동안: "확인 중" 배지. // 1) 설정 조회가 끝나지 않은 동안: "확인 중" 배지.
await page.route(CONFIG_PATTERN, () => { await page.route(CONFIG_PATTERN, () => {
/* 응답을 보류해 조회 중 상태를 고정한다 */ /* 응답을 보류해 조회 중 상태를 고정한다 */