diff --git a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-compact-pseudo-drawer-chromium-visual-linux.png b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-compact-pseudo-drawer-chromium-visual-linux.png index 234b9d6e..03f375b5 100644 Binary files a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-compact-pseudo-drawer-chromium-visual-linux.png and b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-compact-pseudo-drawer-chromium-visual-linux.png differ diff --git a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-wide-light-chromium-visual-linux.png b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-wide-light-chromium-visual-linux.png index d205bdaf..866717e6 100644 Binary files a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-wide-light-chromium-visual-linux.png and b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/app-shell-wide-light-chromium-visual-linux.png differ diff --git a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/platform-overview-light-chromium-visual-linux.png b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/platform-overview-light-chromium-visual-linux.png index 250d39e4..ff0a7948 100644 Binary files a/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/platform-overview-light-chromium-visual-linux.png and b/tests/visual/__snapshots__/platform.visual.spec.ts-snapshots/platform-overview-light-chromium-visual-linux.png differ diff --git a/tests/visual/platform.visual.spec.ts b/tests/visual/platform.visual.spec.ts index 2ef4aad5..c7f95d78 100644 --- a/tests/visual/platform.visual.spec.ts +++ b/tests/visual/platform.visual.spec.ts @@ -3,6 +3,10 @@ import { test, type Page, } from "../support/browser/strict-browser-test.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. @@ -10,10 +14,50 @@ async function expectRouteHeading(page: Page, title: string) { await expect(page.getByRole("heading", { level: 1 })).toHaveText(title); } +/** `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", { fullPage: true, }); @@ -26,6 +70,7 @@ test("compact drawer and pseudo-locale visual contract", async ({ page }) => { 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", { fullPage: true, }); @@ -59,6 +104,15 @@ test("platform composition overview visual contract", async ({ 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", );