From b0195e3d59f385512f87aba9b5e411900669c449 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Wed, 4 Nov 2026 20:18:40 +0900 Subject: [PATCH] =?UTF-8?q?ci(visual):=20=EB=B8=8C=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=EC=A0=80=20=EC=84=A4=EC=B9=98=20=EB=8B=A8=EA=B3=84=EA=B0=80=20?= =?UTF-8?q?=EC=8B=9C=EA=B0=81=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EA=B8=80?= =?UTF-8?q?=EA=BC=B4=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=A5=BC=20=EC=84=A4?= =?UTF-8?q?=EC=B9=98=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제 tests/visual/fonts.conf는 Noto Sans·Noto Sans CJK·Liberation Mono가 있는 OS 글꼴 디렉터리만 읽는다. 생성 workflow의 브라우저 설치 단계는 `playwright install --with-deps` 한 줄이고, Playwright 의존 패키지에는 이 글꼴이 없다. 그래서 빈 러너에서는 FE-GATE-008이 코드와 무관하게 `visual-fonts` 단계에서 실패한다(1101/11-02의 남은 절반). 고른 방법 - 생성기(scripts/generate-ci-workflow.ts)의 browser-install 단계가 `--with-deps` 뒤에 글꼴 패키지 4개를 apt-get으로 설치한다. `--with-deps`가 이미 패키지 목록을 갱신했으므로 update를 다시 하지 않는다. root가 아닌 러너에서만 sudo를 붙인다. - 패키지 목록을 scripts/lib/visual-test-fonts.ts 한 곳에 두고 생성기와 tests/visual/fonts.setup.ts의 설치 안내가 같이 읽는다. - 글꼴이 필요한 것은 FE-GATE-008뿐이지만 브라우저 단계 두 곳 모두에 넣었다. 게이트 ID로 갈라 쓰면 생성기가 게이트 목록에 묶인다. - 버린 대안: job container 고정(러너의 컨테이너 지원 미확인), ci:gate가 패키지 설치(개발자 PC에서도 sudo 요구). 위험·한계 - 실제 러너나 깨끗한 Ubuntu 24.04 컨테이너에서 이 단계를 돌리지 않았다. 패키지 이름과 디렉터리는 이 호스트(Ubuntu)와 fonts.conf로만 확인했다. - CJK 패키지 때문에 브라우저 job 설치 시간이 수십 MB만큼 는다. - gates.json은 바꾸지 않았다(단계 종류는 그대로 browser-install). 검증 - ci-workflow-generation 새 테스트: 생성기 수정 전 실패, 수정 뒤 통과. 파일 전체 424건 통과(스냅샷 1건 갱신). - generate:ci-workflow로 workflow 재생성. check:ci PASS. - lint, check:types:node, check:types:test, verify:documentation PASS. Refs: docs/reviews/2026-11-03-maturity-review/11-tests-browser-release-scale.md 11-02 --- .gitea/workflows/quality-gates.yml | 8 ++++-- .../frontend-platform-testing-strategy.md | 5 +++- scripts/generate-ci-workflow.ts | 8 +++++- scripts/lib/visual-test-fonts.ts | 16 +++++++++++ .../ci-workflow-generation.test.ts.snap | 8 ++++-- tests/unit/ci-workflow-generation.test.ts | 27 +++++++++++++++++++ tests/visual/fonts.setup.ts | 4 ++- 7 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 scripts/lib/visual-test-fonts.ts diff --git a/.gitea/workflows/quality-gates.yml b/.gitea/workflows/quality-gates.yml index 9542cd79..3841d543 100644 --- a/.gitea/workflows/quality-gates.yml +++ b/.gitea/workflows/quality-gates.yml @@ -67,7 +67,9 @@ jobs: corepack pnpm install --frozen-lockfile --ignore-scripts - name: Install Playwright browsers if: ${{ matrix.browser }} - run: corepack pnpm exec playwright install --with-deps chromium firefox webkit + run: | + corepack pnpm exec playwright install --with-deps chromium firefox webkit + $(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation - name: Run blocking gate run: corepack pnpm ci:gate -- ${{ matrix.gate }} - name: Upload merge gate evidence @@ -104,7 +106,9 @@ jobs: corepack pnpm install --frozen-lockfile --ignore-scripts - name: Install Playwright browsers if: ${{ matrix.browser }} - run: corepack pnpm exec playwright install --with-deps chromium firefox webkit + run: | + corepack pnpm exec playwright install --with-deps chromium firefox webkit + $(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation - name: Run blocking gate run: corepack pnpm ci:gate -- ${{ matrix.gate }} - name: Upload release gate evidence diff --git a/docs/testing/frontend-platform-testing-strategy.md b/docs/testing/frontend-platform-testing-strategy.md index f0ea21ab..e262a2ae 100644 --- a/docs/testing/frontend-platform-testing-strategy.md +++ b/docs/testing/frontend-platform-testing-strategy.md @@ -955,7 +955,10 @@ Playwright `toHaveScreenshot()`을 사용한다. - browser 버전과 viewport·scale은 `playwright.visual.config.ts`로, 글꼴은 `tests/visual/fonts.conf`로 고정(Linux 전용). 러너에는 `fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation` - 패키지가 필요하고, 없으면 `visual-fonts` 검사가 설치 명령을 보여 주며 실패한다 + 패키지가 필요하고, 없으면 `visual-fonts` 검사가 설치 명령을 보여 주며 실패한다. + CI의 브라우저 설치 단계가 같은 패키지를 설치한다. 목록은 + `scripts/lib/visual-test-fonts.ts` 한 곳에 있고 생성기와 `visual-fonts` 검사가 + 같이 읽는다(1103/11-02) - animation/caret 비활성화 - clock/random/network fixture 고정 - 개인정보와 동적 ID mask diff --git a/scripts/generate-ci-workflow.ts b/scripts/generate-ci-workflow.ts index b37d8b58..66e68ddb 100644 --- a/scripts/generate-ci-workflow.ts +++ b/scripts/generate-ci-workflow.ts @@ -23,6 +23,7 @@ import { assertSafePublishLeaf, ensureSafePublishDirectory, } from "./lib/ci-gate-log.ts"; +import { VISUAL_TEST_FONT_INSTALL_ARGUMENTS } from "./lib/visual-test-fonts.ts"; export type GenerateCiWorkflowOptions = Readonly<{ root: string; @@ -196,7 +197,12 @@ function renderStep( return [ " - name: Install Playwright browsers", ...(job.kind === "gate-matrix" ? [" if: ${{ matrix.browser }}"] : []), - " run: corepack pnpm exec playwright install --with-deps chromium firefox webkit", + " run: |", + " corepack pnpm exec playwright install --with-deps chromium firefox webkit", + // 1103/11-02. The visual goldens' faces (tests/visual/fonts.conf) are + // not among Playwright's dependencies. `--with-deps` has refreshed the + // package lists; sudo only where the runner is not root. + ` $(command -v sudo || true) ${VISUAL_TEST_FONT_INSTALL_ARGUMENTS}`, ]; case "run-gate": { if (job.kind === "gate-matrix") { diff --git a/scripts/lib/visual-test-fonts.ts b/scripts/lib/visual-test-fonts.ts new file mode 100644 index 00000000..f689f3fa --- /dev/null +++ b/scripts/lib/visual-test-fonts.ts @@ -0,0 +1,16 @@ +/** + * 1103/11-02. The Debian/Ubuntu packages that hold the four faces the visual + * goldens were captured with. `tests/visual/fonts.conf` shows Chromium only + * their directories, Playwright's `--with-deps` does not install them, and + * `tests/visual/fonts.setup.ts` fails with this list when one is missing. The + * CI browser step (`scripts/generate-ci-workflow.ts`) installs the same list, + * so the hint and the runner cannot name different packages. + */ +export const VISUAL_TEST_FONT_PACKAGES = Object.freeze([ + "fonts-noto-core", + "fonts-noto-cjk", + "fonts-noto-cjk-extra", + "fonts-liberation", +] as const); + +export const VISUAL_TEST_FONT_INSTALL_ARGUMENTS = `apt-get install -y ${VISUAL_TEST_FONT_PACKAGES.join(" ")}`; diff --git a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap index 6ff0f0d1..a7f51531 100644 --- a/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap +++ b/tests/unit/__snapshots__/ci-workflow-generation.test.ts.snap @@ -70,7 +70,9 @@ jobs: corepack pnpm install --frozen-lockfile --ignore-scripts - name: Install Playwright browsers if: \${{ matrix.browser }} - run: corepack pnpm exec playwright install --with-deps chromium firefox webkit + run: | + corepack pnpm exec playwright install --with-deps chromium firefox webkit + $(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation - name: Run blocking gate run: corepack pnpm ci:gate -- \${{ matrix.gate }} - name: Upload merge gate evidence @@ -107,7 +109,9 @@ jobs: corepack pnpm install --frozen-lockfile --ignore-scripts - name: Install Playwright browsers if: \${{ matrix.browser }} - run: corepack pnpm exec playwright install --with-deps chromium firefox webkit + run: | + corepack pnpm exec playwright install --with-deps chromium firefox webkit + $(command -v sudo || true) apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation - name: Run blocking gate run: corepack pnpm ci:gate -- \${{ matrix.gate }} - name: Upload release gate evidence diff --git a/tests/unit/ci-workflow-generation.test.ts b/tests/unit/ci-workflow-generation.test.ts index 1fa8fb94..b30c6de1 100644 --- a/tests/unit/ci-workflow-generation.test.ts +++ b/tests/unit/ci-workflow-generation.test.ts @@ -28,6 +28,7 @@ import { validateInstallScriptPolicy, validatePackageScriptGraph, } from "../../scripts/lib/package-script-graph.ts"; +import { VISUAL_TEST_FONT_PACKAGES } from "../../scripts/lib/visual-test-fonts.ts"; const temporaryRoots: string[] = []; const npmPostScriptForeignScopeCommands = [ @@ -1646,6 +1647,32 @@ describe("CI workflow generation", () => { expect(actionUses.every((uses) => /^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+@[0-9a-f]{40}$/u.test(uses!))).toBe(true); }); + // 1103/11-02. tests/visual/fonts.conf reads the goldens' faces from OS + // packages that Playwright's own dependencies do not include, so a clean + // runner failed FE-GATE-008 at `visual-fonts`. Every browser step installs + // them, after `--with-deps` has refreshed the package lists. + it("installs the visual-test font packages in every browser step", async () => { + const workflow = renderCiWorkflow(await loadCiGateContract(process.cwd())); + const browserSteps = workflow + .split(" - name: ") + .filter((step) => step.startsWith("Install Playwright browsers")); + expect(browserSteps).toHaveLength(2); + for (const step of browserSteps) { + const playwright = step.indexOf("playwright install --with-deps"); + const fonts = step.indexOf( + `apt-get install -y ${VISUAL_TEST_FONT_PACKAGES.join(" ")}`, + ); + expect(playwright).toBeGreaterThan(0); + expect(fonts).toBeGreaterThan(playwright); + } + expect(VISUAL_TEST_FONT_PACKAGES).toEqual([ + "fonts-noto-core", + "fonts-noto-cjk", + "fonts-noto-cjk-extra", + "fonts-liberation", + ]); + }); + // 12-01: main is the integration branch; a push there must run the gates. it("runs on pushes to main", async () => { const workflow = renderCiWorkflow(await loadCiGateContract(process.cwd())); diff --git a/tests/visual/fonts.setup.ts b/tests/visual/fonts.setup.ts index 70775bff..db03d79f 100644 --- a/tests/visual/fonts.setup.ts +++ b/tests/visual/fonts.setup.ts @@ -3,6 +3,7 @@ import { test, type Page, } from "../support/browser/strict-browser-test.ts"; +import { VISUAL_TEST_FONT_INSTALL_ARGUMENTS } from "../../scripts/lib/visual-test-fonts.ts"; // 11-02. The goldens were captured with these four faces. `fonts.conf` shows // Chromium only the directories that hold them; this check runs before the @@ -18,7 +19,8 @@ const expectedFaces = { const installHint = [ "Visual tests must draw with the fonts the goldens were captured with.", - "Debian/Ubuntu: sudo apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation", + // 1103/11-02. The CI browser step installs the same list. + `Debian/Ubuntu: sudo ${VISUAL_TEST_FONT_INSTALL_ARGUMENTS}`, "tests/visual/fonts.conf reads them from the Debian/Ubuntu font directories; other OSes have no Linux goldens.", ].join("\n");