ci(visual): 브라우저 설치 단계가 시각 테스트 글꼴 패키지를 설치한다

문제
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
This commit is contained in:
DongHyeonka
2026-11-04 20:18:40 +09:00
parent 004a205748
commit b0195e3d59
7 changed files with 69 additions and 7 deletions
+6 -2
View File
@@ -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
@@ -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
+7 -1
View File
@@ -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") {
+16
View File
@@ -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(" ")}`;
@@ -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
+27
View File
@@ -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()));
+3 -1
View File
@@ -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");