frontend-quality-gates / merge / static checks (pull_request) Successful in 1m14s
frontend-quality-gates / merge / tests (pull_request) Successful in 16m3s
frontend-quality-gates / merge / browser tests (pull_request) Successful in 6m32s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Skipped
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Skipped
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Skipped
frontend-quality-gates / external-vulnerability-provider (pull_request) Skipped
frontend-quality-gates / external-provenance-provider (pull_request) Skipped
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Skipped
frontend-quality-gates / deploy-promoted-release (pull_request) Skipped
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Skipped
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Skipped
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Skipped
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Skipped
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Skipped
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Skipped
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Skipped
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Skipped
frontend-quality-gates / main / self-tests and removal drills (pull_request) Skipped
시각 골든은 `maxDiffPixels: 50`만 정하고 색 허용치(threshold)를 두지 않아 Playwright 기본값 0.2를 쓴다. 0.2는 pixelmatch YIQ 거리로 1408.6까지 같은 색으로 본다. 밝은 `--color-danger-surface`의 색상각 25 → 145(분홍 → 초록, 거리 154.5)와 어두운 `--color-danger` 한 단계(거리 1260.1)가 옛 골든과 새 골든을 모두 통과했다. 그래서 위험 표면이 초록빛으로 바뀌어도 골든이 통과한다. CHANGELOG 알려진 제한으로만 적혀 있었다. 고른 방법: 결정(2026-11-12, 총괄: 흔들림 없는 값을 재서 낮춘다)대로 0.05(거리 88.0)를 쓴다. 기준을 올리는 쪽이다. `playwright.visual.config.ts`는 지금 w2-fe-2가 브라우저 실행 설정을 고치는 중이라 이번에 건드리지 않고, 시각 spec이 모든 screenshot에 `GOLDEN`(threshold 0.05)을 넘긴다. 새 screenshot이 빠뜨리지 않도록 `tests/unit/visual-golden-threshold.test.ts`가 대조한다. 버린 대안: 0.1(거리 352.2라 첫 변이가 다시 통과한다). 위험·한계: 글꼴·래스터 설정을 고정한 깨끗한 빌드는 0 px 차이라는 기존 주장에 기댄다. desktop에서 변이 없이 세 번, 변이로 한 번 돌려 PR 본문에 적는다. 설정 기본값은 0.2 그대로라 다른 Playwright 설정의 screenshot은 이 값을 받지 않는다(지금 다른 곳에는 screenshot이 없다). 검증: 실험 X-02(변이 `--color-danger-surface` 색상각 145에서 0.2는 통과, 0.05는 `state-surfaces-light` 실패, 변이 없이 세 번 통과)는 desktop에서 돌려 PR 본문에 적는다. Refs: 1112/04-11
155 lines
6.1 KiB
TypeScript
155 lines
6.1 KiB
TypeScript
import {
|
|
expect,
|
|
test,
|
|
type Page,
|
|
} from "../support/browser/strict-browser-test.ts";
|
|
import {
|
|
reservedOrigin,
|
|
TEST_PORT_VARIABLES,
|
|
} from "../../scripts/lib/run-isolation.ts";
|
|
import {
|
|
ROUTE_FEATURE_OWNER,
|
|
ROUTE_REGISTRY,
|
|
} from "../../src/features/installed-feature-contracts.ts";
|
|
|
|
// 11-02. `main` is drawn before the route chunk arrives; a screenshot taken
|
|
// then pins the loading surface instead of the page.
|
|
async function expectRouteHeading(page: Page, title: string) {
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(title);
|
|
}
|
|
|
|
/**
|
|
* A gallery story in the static workshop the config's second server serves
|
|
* (src/presentation/design-system/galleries.stories.tsx). The a11y addon's own
|
|
* axe run is switched off, as in tests/storybook: it has nothing to draw.
|
|
*/
|
|
async function openGalleryStory(page: Page, storyId: string, title: string) {
|
|
await page.goto(
|
|
`${reservedOrigin(TEST_PORT_VARIABLES.visualWorkshop)}/iframe.html?id=${storyId}&viewMode=story&globals=a11y.manual:!true`,
|
|
);
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(title);
|
|
}
|
|
|
|
/**
|
|
* 1112/04-11. How far one pixel's colour may move before it counts as
|
|
* changed (pixelmatch's YIQ distance; Playwright's default is 0.2). At 0.2 a
|
|
* danger surface turned green (hue 25 to 145) and the dark danger colour one
|
|
* palette step darker both passed the goldens. 0.05 fails the first; a clean
|
|
* build still differs by 0 px. Every screenshot below takes it; the pixel
|
|
* count `maxDiffPixels` stays in playwright.visual.config.ts.
|
|
*/
|
|
const GOLDEN = Object.freeze({ threshold: 0.05 });
|
|
|
|
/** `toHaveScreenshot` takes a stylesheet only as a file; a tag does the same. */
|
|
async function hide(page: Page, css: string) {
|
|
if (css !== "") await page.addStyleTag({ content: css });
|
|
}
|
|
|
|
/**
|
|
* 1103/12-01. These goldens are the template's own drawing: the shell, the
|
|
* home page and the platform overview. Those screens also draw whatever
|
|
* features are installed, so one `create:feature` failed this merge gate and
|
|
* only re-capturing template-owned PNGs made it pass. The screenshots leave
|
|
* the installed features' parts out (`display: none`, so a longer list does
|
|
* not move the rest): every link to a feature route, with its list item, and
|
|
* the overview sections that count or list the installed features. Their
|
|
* number and order are the component tests' subject; the shell's own CSS
|
|
* still fails here.
|
|
*/
|
|
const FEATURE_ROUTE_PATHS = Object.values(ROUTE_REGISTRY)
|
|
.filter((route) => ROUTE_FEATURE_OWNER[route.routeId] !== undefined)
|
|
.map((route) => route.path);
|
|
const WITHOUT_FEATURE_LINKS =
|
|
FEATURE_ROUTE_PATHS.length === 0
|
|
? ""
|
|
: `${FEATURE_ROUTE_PATHS.flatMap((path) => [
|
|
`li:has(> a[href="${path}"])`,
|
|
`a[href="${path}"]`,
|
|
]).join(",\n")} { display: none !important; }`;
|
|
const WITHOUT_INSTALLED_FEATURE_SECTIONS = `${[
|
|
"platform-summary-title",
|
|
"platform-routes-title",
|
|
"platform-contracts-title",
|
|
"platform-features-title",
|
|
]
|
|
.map((id) => `section[aria-labelledby="${id}"]`)
|
|
.join(",\n")} { display: none !important; }
|
|
section[aria-labelledby="platform-release-title"] .platform-metric:nth-child(4) dd {
|
|
/* The contract-set digest: a feature's contract package changes it. */
|
|
visibility: hidden !important;
|
|
}`;
|
|
|
|
test("wide application shell visual contract", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1440, height: 900 });
|
|
await page.goto("/");
|
|
await expectRouteHeading(page, "Clean Architecture Frontend");
|
|
await hide(page, WITHOUT_FEATURE_LINKS);
|
|
await expect(page).toHaveScreenshot("app-shell-wide-light.png", {
|
|
...GOLDEN,
|
|
fullPage: true,
|
|
});
|
|
});
|
|
|
|
test("compact drawer and pseudo-locale visual contract", async ({ page }) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await page.goto("/");
|
|
await expectRouteHeading(page, "Clean Architecture Frontend");
|
|
await page.locator("#locale-preference").selectOption("en-XA");
|
|
await page.locator(".app-shell__menu-button").click();
|
|
await expect(page.locator(".ui-drawer")).toHaveJSProperty("open", true);
|
|
await hide(page, WITHOUT_FEATURE_LINKS);
|
|
await expect(page).toHaveScreenshot("app-shell-compact-pseudo-drawer.png", {
|
|
...GOLDEN,
|
|
fullPage: true,
|
|
});
|
|
});
|
|
|
|
test.describe("in the dark color scheme", () => {
|
|
// The workshop has no theme selector: the theme provider follows the
|
|
// system preference there, as the app does until a user picks one.
|
|
test.use({ colorScheme: "dark" });
|
|
|
|
test("design-system gallery dark visual contract", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 900 });
|
|
await openGalleryStory(page, "platform-galleries--design-system", "UI 구성요소");
|
|
await expect(page.locator("html")).toHaveAttribute("data-theme", "dark");
|
|
await expect(page.getByRole("main")).toHaveScreenshot(
|
|
"design-system-gallery-dark.png",
|
|
GOLDEN,
|
|
);
|
|
});
|
|
});
|
|
|
|
test("loading empty error and access surfaces visual contract", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 1280, height: 1100 });
|
|
await openGalleryStory(page, "platform-galleries--screen-states", "화면 상태");
|
|
await expect(page.getByRole("main")).toHaveScreenshot(
|
|
"state-surfaces-light.png",
|
|
GOLDEN,
|
|
);
|
|
});
|
|
|
|
test("platform composition overview visual contract", async ({ page }) => {
|
|
await page.setViewportSize({ width: 1280, height: 1100 });
|
|
await page.goto("/examples/platform");
|
|
await expectRouteHeading(page, "플랫폼 구성");
|
|
await expect(
|
|
page.locator("section[aria-labelledby='platform-capabilities-title']"),
|
|
).toBeVisible();
|
|
// 1103/15-01. The contract tables fill in after the title; wait for them so
|
|
// the hidden sections are drawn in their final state either way.
|
|
await expect(page.locator("main [aria-busy='true']")).toHaveCount(0);
|
|
await expect(
|
|
page
|
|
.locator("section[aria-labelledby='platform-release-title'] dt")
|
|
.filter({ hasText: "계약 집합 다이제스트" }),
|
|
).toBeVisible();
|
|
await hide(page, WITHOUT_INSTALLED_FEATURE_SECTIONS);
|
|
await expect(page.getByRole("main")).toHaveScreenshot(
|
|
"platform-overview-light.png",
|
|
GOLDEN,
|
|
);
|
|
});
|