Files
clean-architecture-frontend…/tests/e2e/compact-smoke.spec.ts
DongHyeonka b3ce732249 test(e2e): compact smoke가 빌드에 준 VITE_BUILD_ID를 기대값으로 쓴다
문제
tests/e2e/compact-smoke.spec.ts가 html의 data-build-id를 "local-build"로
고정해 비교한다. workflow는 전체 env에 VITE_BUILD_ID=gitea-<run>-<attempt>를
넣고, preview 서버가 그 env로 빌드한다. 그래서 실제 CI에서 FE-GATE-008이
코드와 무관하게 항상 실패한다.

고른 방법
- 기대값을 이 프로세스의 VITE_BUILD_ID에서 읽고, 비었으면 "local-build"를
  쓴다. playwright webServer가 같은 env로 빌드하고,
  scripts/generate-runtime-config.ts가 같은 규칙(값 || "local-build")으로
  BUILD_ID를 정한다.
- 버린 대안: build id가 비어 있지 않은지만 보기. 빌드에 준 값이 화면까지
  오는지(release manifest·runtime config 일치)를 더는 확인하지 못한다.
  vite loadEnv로 .env 파일까지 읽기. build id는 .env가 아니라 프로세스
  env에서만 온다(generate-runtime-config.ts, generate-build-manifest.ts).

위험·한계
- CI=true와 러너 이미지 조건, ci:gate FE-GATE-008 전체는 돌리지 않았다.

검증
- RED: VITE_BUILD_ID=gitea-1-1로 chromium-compact 1건 실패
  (data-build-id "local-build" 기대).
- 수정 뒤 VITE_BUILD_ID=gitea-1-1, 기본값 두 경우 모두 1 passed.

Refs: docs/reviews/2026-11-03-maturity-review/README.md 11-06
2026-11-04 20:23:33 +09:00

33 lines
1.5 KiB
TypeScript

import { expect, test } from "../support/browser/strict-browser-test.ts";
/**
* 1103/11-06. The preview server serves a build made from this process's
* environment (playwright.config.ts webServer), and the build takes its
* identity from VITE_BUILD_ID the way scripts/generate-runtime-config.ts
* does: CI sets gitea-<run>-<attempt>, a local run falls back to
* "local-build". A fixed "local-build" failed FE-GATE-008 in every CI run.
*/
const EXPECTED_BUILD_ID = process.env["VITE_BUILD_ID"] || "local-build";
test("boots and navigates the compact production shell", async ({ page }) => {
await page.goto("/");
await expect(page.getByRole("main")).toBeVisible();
const menu = page.getByRole("button", { name: "메뉴", exact: true });
await expect(menu).toHaveCSS("min-width", "44px");
await menu.click();
const navigation = page.getByRole("navigation", { name: "주요 탐색" });
await expect(navigation).toBeVisible();
// The drawer is a non-modal dialog, so page content stays in the
// accessibility tree while it is open. Scope to the navigation and match the
// whole name, or a route call to action on the page behind it also matches.
await navigation
.getByRole("link", { name: "UI 구성요소", exact: true })
.click();
await expect(page).toHaveURL(/\/examples\/ui$/);
await expect(page.locator("html")).toHaveAttribute("data-build-id", EXPECTED_BUILD_ID);
const overflow = await page.evaluate(
() => document.documentElement.scrollWidth - window.innerWidth,
);
expect(overflow).toBeLessThanOrEqual(1);
});