fix: UI 감사와 11-01·11-03 성숙도 리뷰의 발견을 반영한다 #4

Merged
donghyeon.kang merged 361 commits from fix/ui-design-audit-2026-11-01 into main 2026-11-05 10:33:58 +00:00
5 changed files with 125 additions and 3 deletions
Showing only changes of commit 08b5ccc86e - Show all commits
+1 -1
View File
@@ -635,7 +635,7 @@ Form과 overlay는 다음 story를 추가한다.
필수 안정화:
- 동일한 Linux image, browser version, font
- 동일한 browser version과 글꼴(`tests/visual/fonts.conf`, Linux 전용)
- animation과 caret 비활성화
- 시간·랜덤·network 응답 고정
- 동적 ID와 민감 데이터 mask
@@ -933,7 +933,10 @@ Playwright `toHaveScreenshot()`을 사용한다.
결정성 규칙:
- OS, browser, font, device scale을 CI image로 고정
- 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` 검사가 설치 명령을 보여 주며 실패한다
- animation/caret 비활성화
- clock/random/network fixture 고정
- 개인정보와 동적 ID mask
+17 -1
View File
@@ -1,3 +1,5 @@
import { fileURLToPath } from "node:url";
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
@@ -27,6 +29,17 @@ export default defineConfig({
colorScheme: "light",
locale: "en-US",
trace: "retain-on-failure",
launchOptions: {
// 11-02. Chromium sees only the fonts the goldens were captured with,
// whatever the host or an outer FONTCONFIG_FILE says. The
// `visual-fonts` project checks them before any screenshot.
env: {
...process.env,
FONTCONFIG_FILE: fileURLToPath(
new URL("./tests/visual/fonts.conf", import.meta.url),
),
},
},
},
webServer: {
command:
@@ -34,5 +47,8 @@ export default defineConfig({
url: "http://127.0.0.1:4174",
reuseExistingServer: false,
},
projects: [{ name: "chromium-visual" }],
projects: [
{ name: "visual-fonts", testMatch: /fonts\.setup\.ts$/ },
{ name: "chromium-visual", dependencies: ["visual-fonts"] },
],
});
+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<!--
11-02. Font set for the visual tests (playwright.visual.config.ts passes it
to Chromium as FONTCONFIG_FILE). The goldens were captured with Noto Sans,
Noto Sans CJK KR (Regular and Black) and Liberation Mono, so Chromium sees
only the directories that hold them, at their Debian/Ubuntu paths:
sudo apt-get install -y fonts-noto-core fonts-noto-cjk fonts-noto-cjk-extra fonts-liberation
A missing directory is skipped silently here; tests/visual/fonts.setup.ts
fails the run with that install line instead. Linux only: Chromium on macOS
and Windows does not read fontconfig.
-->
<fontconfig>
<dir>/usr/share/fonts/truetype/noto</dir>
<dir>/usr/share/fonts/opentype/noto</dir>
<dir>/usr/share/fonts/truetype/liberation</dir>
<cachedir>/var/cache/fontconfig</cachedir>
<cachedir prefix="xdg">fontconfig</cachedir>
<!-- The host's generic-family aliases: sans-serif to Noto Sans, Courier
New (Chromium's default monospace) to Liberation Mono. -->
<include ignore_missing="yes">/etc/fonts/conf.d</include>
<!-- Rasterization the goldens were captured with. Placed after the host
rules so a runner whose fontconfig defaults differ (sub-pixel order,
hint style) still draws the same pixels. -->
<match target="font">
<edit name="antialias" mode="assign"><bool>true</bool></edit>
<edit name="hinting" mode="assign"><bool>true</bool></edit>
<edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
<edit name="autohint" mode="assign"><bool>false</bool></edit>
<edit name="rgba" mode="assign"><const>rgb</const></edit>
<edit name="lcdfilter" mode="assign"><const>lcddefault</const></edit>
</match>
</fontconfig>
+66
View File
@@ -0,0 +1,66 @@
import {
expect,
test,
type Page,
} from "../support/browser/strict-browser-test.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
// screenshots so a missing or substituted font fails here with an install
// hint instead of as a whole-page pixel diff. Probes sit in the real page so
// they get its CSS (`--font-sans`) and `lang`, which decide the fallbacks.
const expectedFaces = {
latin: "Noto Sans",
korean: "Noto Sans CJK KR",
"korean-800": "Noto Sans CJK KR Black",
code: "Liberation Mono",
};
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",
"tests/visual/fonts.conf reads them from the Debian/Ubuntu font directories; other OSes have no Linux goldens.",
].join("\n");
async function drawnFaces(page: Page) {
await page.goto("/");
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
await page.evaluate(() => {
const probes = document.createElement("div");
probes.innerHTML = `
<p data-font-probe="latin">Clean Architecture Frontend</p>
<p data-font-probe="korean">플랫폼구성화면상태</p>
<p data-font-probe="korean-800" style="font-weight: 800">플랫폼구성화면상태</p>
<code data-font-probe="code">const value = 42;</code>`;
document.body.append(probes);
});
const cdp = await page.context().newCDPSession(page);
await cdp.send("DOM.enable");
await cdp.send("CSS.enable");
const { root } = await cdp.send("DOM.getDocument");
const drawn: Record<string, string> = {};
for (const probe of Object.keys(expectedFaces)) {
const { nodeId } = await cdp.send("DOM.querySelector", {
nodeId: root.nodeId,
selector: `[data-font-probe="${probe}"]`,
});
const { fonts } = await cdp.send("CSS.getPlatformFontsForNode", { nodeId });
drawn[probe] = fonts.map((font) => font.familyName).join(" + ");
}
return drawn;
}
test("visual fonts match the goldens", async ({ page }) => {
let drawn: Record<string, string>;
try {
drawn = await drawnFaces(page);
} catch (error) {
// With no font at all the renderer crashes, so the page never draws.
throw new Error(
`${installHint}\nThe font probe page did not render: ${String(error)}`,
{ cause: error },
);
}
expect(drawn, installHint).toEqual(expectedFaces);
});