Merge pull request 'test: 브라우저 게이트의 시험 쪽 실패를 고치고 질문 라벨 대비를 올린다' (#7) from fix/browser-gates into main

This commit was merged in pull request #7.
This commit is contained in:
2026-11-12 06:45:21 +00:00
15 changed files with 157 additions and 61 deletions
@@ -3443,10 +3443,12 @@ summary {
margin-top: 22px;
}
/* The box is the info surface (#eef1fc), where `--faint` is 4.46:1 and misses
WCAG AA; `--muted` is 5.85:1 there. */
.next-validation-why > p,
.next-validation-how > p {
margin: 0 0 8px;
color: var(--faint);
color: var(--muted);
font-size: 12px;
font-weight: 650;
letter-spacing: 0.06em;
+6 -1
View File
@@ -3,6 +3,7 @@ import AxeBuilder from "@axe-core/playwright";
import { expect, test } from "../support/browser/strict-browser-test.ts";
import {
gotoTechLog,
gotoTechLogStudio,
TECH_LOG_CANONICAL_ROUTES,
} from "../support/browser/tech-log-fixtures.ts";
@@ -12,7 +13,11 @@ for (const route of TECH_LOG_CANONICAL_ROUTES.filter(
test(`@a11y ${route.routeId} has no critical or serious Axe violations`, async ({
page,
}) => {
await gotoTechLog(page, route.path);
// A Studio route checks the screen a writer gets, not the sign-in surface.
await (route.layout === "STUDIO" ? gotoTechLogStudio : gotoTechLog)(
page,
route.path,
);
const results = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
+14 -20
View File
@@ -3,9 +3,7 @@ import { gotoTechLog } from "../support/browser/tech-log-fixtures.ts";
test("boots the public app shell", async ({ page }) => {
await gotoTechLog(page, "/");
await expect(page.getByRole("heading", { level: 1 })).toHaveText(
"Tech Log",
);
await expect(page.getByRole("heading", { level: 1 })).toHaveText("TechLog");
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
await expect(page.getByRole("main")).toBeVisible();
});
@@ -40,25 +38,27 @@ test("provides an escape-dismissible mobile navigation", async ({ page }) => {
await expect(menu).toBeFocused();
});
// R3-6. A drawer link closes the modal drawer and changes the route in the
// same click. The drawer's deferred focus restore must not win over the new
// page's heading focus; Escape (no navigation) still returns to the menu.
// R3-6 (template sync af3d8e6). A drawer link closes the drawer and changes
// the route in the same click. The new page's heading takes focus; it must not
// go back to the menu. Upstream drives its own drawer and example page; this is
// TechLog's `details.mobile-nav` and a primary-navigation page.
test("moves focus to the new page after a mobile drawer link, not back to the menu", async ({
page,
}) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto("/");
const menu = page.getByRole("button", { name: "메뉴", exact: true });
const navigation = page.getByRole("navigation", { name: "주요 탐색" });
await gotoTechLog(page, "/");
const drawer = page.locator("details.mobile-nav");
const menu = drawer.locator("> summary");
const navigation = page.getByRole("navigation", { name: "모바일 주요 탐색" });
await menu.click();
await navigation.getByRole("link", { name: "화면 상태" }).click();
await navigation.getByRole("link", { name: "프로젝트" }).click();
await expect(page).toHaveURL(/\/examples\/states$/);
await expect(menu).toHaveAttribute("aria-expanded", "false");
const heading = page.getByRole("heading", { level: 1, name: "화면 상태" });
await expect(page).toHaveURL(/\/projects$/);
await expect(drawer).not.toHaveAttribute("open", "");
const heading = page.getByRole("heading", { level: 1, name: "프로젝트" });
await expect(heading).toBeFocused();
// Give any late restore (dialog close timer, lazy route commit) time to run.
// Give any late restore (lazy route commit) time to run.
await page.waitForTimeout(300);
expect(
await page.evaluate(() => {
@@ -67,10 +67,4 @@ test("moves focus to the new page after a mobile drawer link, not back to the me
}),
).toBe(true);
await expect(menu).not.toBeFocused();
await menu.click();
await expect(navigation).toBeVisible();
await page.keyboard.press("Escape");
await expect(navigation).toBeHidden();
await expect(menu).toBeFocused();
});
+4 -2
View File
@@ -25,10 +25,12 @@ test.beforeAll(async () => {
{
name: "broken",
edit: (root) =>
// Template sync (af3d8e6): this product composes TechLog's catalogs
// next to the installed modules', so the duplicate is TechLog's.
editOnce(
path.join(root, "src/features/installed-feature-messages.ts"),
"composeInstalledMessageCatalogs(\n INSTALLED_PRODUCT_FEATURE_MODULES,\n)",
"composeInstalledMessageCatalogs([\n ...INSTALLED_PRODUCT_FEATURE_MODULES,\n ...INSTALLED_PRODUCT_FEATURE_MODULES,\n])",
" Object.freeze({ messages: TECH_LOG_MESSAGE_CATALOGS }),\n]",
" Object.freeze({ messages: TECH_LOG_MESSAGE_CATALOGS }),\n Object.freeze({ messages: TECH_LOG_MESSAGE_CATALOGS }),\n]",
),
},
]);
+5 -3
View File
@@ -21,10 +21,12 @@ import { startBuildServer } from "./support/service-worker-builds.ts";
// Template sync (af3d8e6). Upstream uses two of its example pages, which this
// product deleted; two TechLog primary-navigation pages play the same part.
const PLATFORM = ROUTE_REGISTRY.TECH_LOG_EXPLORE;
// Not Explore: the home page preloads the Explore (and Profile) chunk, so a
// tab on A already holds it and never asks the server for it again.
const PLATFORM = ROUTE_REGISTRY.TECH_LOG_PROJECTS;
const UI = ROUTE_REGISTRY.TECH_LOG_TOPICS;
const PAGES = [
"src/features/tech-log/presentation/public/pages/explore-page.tsx",
"src/features/tech-log/presentation/public/pages/projects-page.tsx",
"src/features/tech-log/presentation/public/pages/topics-page.tsx",
] as const;
@@ -63,7 +65,7 @@ async function routeChunk(dist: string, chunkId: string): Promise<string> {
// may also log the 404 itself (without its URL), Firefox logs the error
// object React caught, and WebKit logs its own import error without the URL.
// Nothing else is allowed.
const MISSING_PAGE = String.raw`/assets/route-tech-log-(?:explore|topics)-[\w-]+\.js`;
const MISSING_PAGE = String.raw`/assets/route-tech-log-(?:projects|topics)-[\w-]+\.js`;
test.use({
allowedBrowserFailure: new RegExp(
[
+10 -6
View File
@@ -54,17 +54,21 @@ test("boots and changes route under the production security headers", async ({ p
expect(response?.headers()["content-security-policy"]).toBe(
securityHeaders["Content-Security-Policy"],
);
await expect(page.getByRole("heading", { level: 1 })).toHaveText(
"Clean Architecture Frontend",
);
// Template sync (af3d8e6): TechLog's home and a primary-navigation page in
// place of upstream's example screens.
await expect(page.getByRole("heading", { level: 1 })).toHaveText("TechLog");
await page
.getByRole("navigation", { name: "주요 탐색" })
.getByRole("link", { name: "화면 상태" })
.getByRole("link", { name: "프로젝트" })
.click();
// Upstream also waits for route focus here. TechLog's Public shell does not
// move focus on navigation (app-router.tsx leaves it to the shell); that is
// app-shell.spec.ts's to check, so this smoke stays about the policy.
await expect(page).toHaveURL(/\/projects$/);
await expect(
page.getByRole("heading", { level: 1, name: "화면 상태" }),
).toBeFocused();
page.getByRole("heading", { level: 1, name: "프로젝트" }),
).toBeVisible();
expect(await cspViolations(page)).toEqual([]);
});
+18 -8
View File
@@ -2,37 +2,47 @@ import { expect, test, type Page } from "../support/browser/strict-browser-test.
const scrollY = (page: Page) => page.evaluate(() => Math.round(window.scrollY));
// Template sync (af3d8e6). Upstream scrolls its long example page; this product
// deleted it, and a TechLog Case (about 6,000px at 1280x720) is the long page.
const LONG_PAGE = "/cases/collection-fetch-join-pagination";
const LONG_PAGE_TITLE = "컬렉션 Fetch Join과 페이징은 왜 충돌하는가";
// 08-08. Back restores where the user was; a new route starts at the top.
// The Case body fills in after the title, so the test waits for it before it
// scrolls.
test("restores the scroll position when navigating back", async ({ page }) => {
const heading = page.getByRole("heading", { level: 1 });
await page.goto("/examples/ui");
await expect(heading).toHaveText("UI 구성요소");
await page.goto(LONG_PAGE);
await expect(heading).toHaveText(LONG_PAGE_TITLE);
await expect(page.locator("main [aria-busy='true']")).toHaveCount(0);
await expect(page.locator("#remaining-cost")).toBeAttached();
await page.evaluate(() => window.scrollTo(0, 900));
await expect.poll(() => scrollY(page)).toBe(900);
await page
.getByRole("navigation", { name: "주요 탐색" })
.getByRole("link", { name: "화면 상태" })
.getByRole("link", { name: "프로젝트" })
.click();
await expect(heading).toHaveText("화면 상태");
await expect(heading).toHaveText("프로젝트");
await expect.poll(() => scrollY(page)).toBe(0);
await page.goBack();
await expect(heading).toHaveText("UI 구성요소");
await expect(heading).toHaveText(LONG_PAGE_TITLE);
await expect.poll(() => scrollY(page)).toBe(900);
});
// A section well below the first screen. The header is the TechLog site header.
test("opens a hash link at its target below the sticky header", async ({
page,
}) => {
await page.goto("/examples/ui#tokens-title");
const target = page.locator("#tokens-title");
await page.goto(`${LONG_PAGE}#separate-loading`);
const target = page.locator("#separate-loading");
await expect(target).toBeInViewport();
const top = await target.evaluate((element) =>
Math.round(element.getBoundingClientRect().top),
);
const headerBottom = await page
.locator(".app-shell__header")
.locator(".site-header")
.evaluate((element) => Math.round(element.getBoundingClientRect().bottom));
expect(top).toBeGreaterThanOrEqual(headerBottom);
expect(await scrollY(page)).toBeGreaterThan(0);
+15 -2
View File
@@ -1,6 +1,7 @@
import { appendFile, readdir, readFile } from "node:fs/promises";
import path from "node:path";
import { collectStaticAssets } from "../../scripts/generate-service-worker-assets.ts";
import { expect, test, type Page } from "../support/browser/strict-browser-test.ts";
import {
prepareServiceWorkerBuilds,
@@ -39,8 +40,10 @@ let builds: ServiceWorkerBuilds | undefined;
// because they embedded the build ID; since 09-02 they do not, so two builds
// of the same source emit the same route chunks. A dynamically imported
// module keeps all its exports, so the extra export survives the bundler.
// Template sync (af3d8e6): upstream's not-found page is TechLog's Public one,
// lazy-loaded like upstream's by `tech-log-route-runtime.tsx`.
const CHANGED_ROUTE_SOURCE =
"src/presentation/pages/not-found-page.tsx";
"src/features/tech-log/presentation/public/pages/public-not-found-page.tsx";
test.beforeAll(async () => {
test.setTimeout(180_000);
@@ -89,6 +92,16 @@ async function hashedAssets(dist: string): Promise<string[]> {
.sort();
}
// Template sync (af3d8e6). Upstream compares the cache with every file under
// assets/, which is its whole static asset set. This product's set differs
// from that folder both ways: IBM Plex Mono's `.woff` fallbacks there are not
// cacheable (SW-RR-03), and `media/` files outside it are. So the expected set
// is the one the build declares, from the generator's own scan.
async function staticAssetSet(dist: string): Promise<string[]> {
const manifest = await collectStaticAssets(dist, "expected", "expected");
return manifest.assets.map((asset) => asset.url).sort();
}
const headerCases = [
{
name: "Content-Type: application/javascript",
@@ -121,7 +134,7 @@ for (const { name, headers } of headerCases) {
return { names, paths };
});
expect(cached.names).toHaveLength(1);
expect(cached.paths.sort()).toEqual(await hashedAssets(dist.a));
expect(cached.paths.sort()).toEqual(await staticAssetSet(dist.a));
// The server really sent the headers under test.
const assets = server.served.filter((response) =>
+7 -4
View File
@@ -1,7 +1,10 @@
import AxeBuilder from "@axe-core/playwright";
import { expect, test } from "../support/browser/strict-browser-test.ts";
import { gotoTechLog } from "../support/browser/tech-log-fixtures.ts";
import {
gotoTechLog,
gotoTechLogStudio,
} from "../support/browser/tech-log-fixtures.ts";
function blockingViolations(results: Awaited<ReturnType<AxeBuilder["analyze"]>>) {
return results.violations.filter((violation) =>
@@ -26,7 +29,7 @@ test("Studio mobile navigation is keyboard reachable and exposes its expanded st
page,
}) => {
await page.setViewportSize({ width: 390, height: 844 });
await gotoTechLog(page, "/studio");
await gotoTechLogStudio(page, "/studio");
const trigger = page.locator(".studio-menu-trigger");
await trigger.focus();
await page.keyboard.press("Enter");
@@ -37,7 +40,7 @@ test("Studio mobile navigation is keyboard reachable and exposes its expanded st
test("dirty-leave dialog is labelled, traps focus, and restores the invoking link", async ({
page,
}) => {
await gotoTechLog(
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
@@ -63,7 +66,7 @@ test("open Public search and Studio leave dialogs have no blocking Axe findings"
.analyze();
expect(blockingViolations(results)).toEqual([]);
await gotoTechLog(
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
+17 -1
View File
@@ -34,8 +34,24 @@ for (const path of knownSpaPaths) {
});
}
// 6784eb1 (08-20). The server matches each registered Public route as a
// pattern, not the slugs the build saw, so a record published after the build
// is reachable. A slug nobody published is the SPA's in-shell not-found, not an
// edge 404.
test("production HTTP serves the SPA for a slug the build has not seen", async ({
request,
}) => {
const response = await request.get("/projects/missing-project");
expect(response.status()).toBe(200);
expect(response.headers()["content-type"]).toBe("text/html;charset=UTF-8");
expect((await response.text()).startsWith("<!doctype html>")).toBe(true);
});
// A route parameter matches one segment, so a second segment is still an edge
// 404, as is a path no route declares.
for (const path of [
"/projects/missing-project",
"/projects/missing-project/unknown-tab",
"/definitely-not-a-product-route",
]) {
test(`production HTTP returns the source-exact raw 404 for ${path}`, async ({
+2 -1
View File
@@ -1,6 +1,7 @@
import { expect, test } from "../support/browser/strict-browser-test.ts";
import {
gotoTechLog,
gotoTechLogStudio,
horizontalOverflow,
TECH_LOG_BREAKPOINT_WIDTHS,
} from "../support/browser/tech-log-fixtures.ts";
@@ -29,7 +30,7 @@ for (const width of [1050, 1024, 980, 900, 820, 768, 767, 420, 390, 375] as cons
page,
}) => {
await page.setViewportSize({ width, height: 1000 });
await gotoTechLog(
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
+10 -3
View File
@@ -1,10 +1,15 @@
import { FIXTURE_IDS } from "../../src/features/tech-log/adapters/mock/fixtures.ts";
import { expect, test } from "../support/browser/strict-browser-test.ts";
import { gotoTechLogStudio } from "../support/browser/tech-log-fixtures.ts";
// The mock validation of a saved version is valid for 30 minutes on
// 2026-08-14, so these run on the fixture clock (`gotoTechLogStudio`), like
// every other Studio browser test; on the real clock the result reads as stale.
test("validates, previews, publishes, and unpublishes one Studio working copy", async ({
page,
}) => {
await page.goto(
await gotoTechLogStudio(
page,
`/studio/documents/${FIXTURE_IDS.stateNonceReference}/validation`,
);
await expect(
@@ -49,7 +54,8 @@ test("validates, previews, publishes, and unpublishes one Studio working copy",
test("renders an immutable historical snapshot and Studio-local missing event", async ({
page,
}) => {
await page.goto(
await gotoTechLogStudio(
page,
`/studio/publications/${FIXTURE_IDS.fetchPublishedEvent}/preview`,
);
await expect(
@@ -59,7 +65,8 @@ test("renders an immutable historical snapshot and Studio-local missing event",
page.getByText("게시 후 본문 측정값을 보완한 저장본입니다."),
).toHaveCount(0);
await page.goto(
await gotoTechLogStudio(
page,
"/studio/publications/99999999-9999-4999-8999-999999999999/preview",
);
await expect(
+13 -1
View File
@@ -5,10 +5,22 @@ import {
type Page,
} from "@playwright/test";
/**
* Firefox's font sanitizer (OTS) reports that the `name` table of the bundled
* `pretendard` 1.3.9 variable font lists its records out of order. It sorts
* them itself and the font still loads (`document.fonts.check` is true in
* Firefox); Chromium and WebKit say nothing. The file is the npm package's, not
* ours. Only this exact warning for this font is ignored: a font the sanitizer
* rejects logs a different line and still fails.
*/
const FIREFOX_PRETENDARD_NAME_ORDER =
/^\[JavaScript Warning: "downloadable font: name: name records are not sorted\. \(font-family: "Pretendard Variable" style:normal weight:45\.\.920 stretch:100 src index:0\) source: http:\/\/127\.0\.0\.1:\d+\/[\w./@-]*PretendardVariable(?:-[\w-]+)?\.woff2"\]$/u;
function ignoredConsole(message: ConsoleMessage) {
return (
message.type() === "warning" &&
message.text().includes("NO_COLOR")
(message.text().includes("NO_COLOR") ||
FIREFOX_PRETENDARD_NAME_ORDER.test(message.text()))
);
}
@@ -138,6 +138,27 @@ export async function gotoTechLog(page: Page, path: string) {
await settleTechLogPage(page);
}
/**
* 5e2b1a5 (08-20). A signed-out visitor gets only the sign-in surface on a
* Studio route. The e2e build is the local profile (`AUTH_MODE: "demo"`), whose
* session starts signed out and lives in memory, so every page load starts
* signed out again. This signs in with the button a writer uses and waits for
* the Studio chrome that only a signed-in session gets.
*/
export async function signInToStudio(page: Page) {
const gate = page.locator('[data-surface="authentication-required"]');
await gate.getByRole("button", { name: "로그인 시작" }).click();
await page.locator("header.studio-header").waitFor();
await gate.waitFor({ state: "detached" });
await page.waitForLoadState("networkidle");
}
/** `gotoTechLog` for a Studio route, signed in. */
export async function gotoTechLogStudio(page: Page, path: string) {
await gotoTechLog(page, path);
await signInToStudio(page);
}
export async function horizontalOverflow(page: Page) {
return page.evaluate(() => ({
clientWidth: document.documentElement.clientWidth,
+12 -8
View File
@@ -1,6 +1,7 @@
import { expect, test } from "../support/browser/strict-browser-test.ts";
import {
gotoTechLog,
gotoTechLogStudio,
TECH_LOG_BREAKPOINT_WIDTHS,
TECH_LOG_CANONICAL_ROUTES,
TECH_LOG_PUBLIC_FIXTURE_PATHS,
@@ -16,7 +17,10 @@ for (const route of TECH_LOG_CANONICAL_ROUTES) {
for (const width of [360, 1440] as const) {
test(`${route.routeId} matches the reviewed ${width}px visual`, async ({ page }) => {
await page.setViewportSize({ width, height: 1000 });
await gotoTechLog(page, route.path);
await (route.layout === "STUDIO" ? gotoTechLogStudio : gotoTechLog)(
page,
route.path,
);
await expect(page).toHaveScreenshot(`${route.routeId.toLowerCase()}-${width}.png`, {
fullPage: true,
});
@@ -49,7 +53,7 @@ for (const width of TECH_LOG_BREAKPOINT_WIDTHS) {
for (const [state, path] of TECH_LOG_STUDIO_STATE_PATHS) {
test(`Studio ${state} matches its reviewed wide state visual`, async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLog(page, path);
await gotoTechLogStudio(page, path);
await expect(page).toHaveScreenshot(`tech-log-studio-${state}-1440.png`, {
fullPage: true,
});
@@ -82,7 +86,7 @@ test("open Public search dialog matches the source without a mask", async ({ pag
test("open Studio mobile menu matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await gotoTechLog(page, "/studio");
await gotoTechLogStudio(page, "/studio");
await page.getByRole("button", { name: "Studio 메뉴 열기" }).click();
await expect(page).toHaveScreenshot("tech-log-studio-mobile-menu-390.png", {
fullPage: true,
@@ -91,7 +95,7 @@ test("open Studio mobile menu matches the source without a mask", async ({ page
test("Studio immediate preview matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLog(
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
@@ -103,7 +107,7 @@ test("Studio immediate preview matches the source without a mask", async ({ page
test("Studio dirty-leave dialog matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLog(
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
@@ -119,7 +123,7 @@ test("Studio dirty-leave dialog matches the source without a mask", async ({ pag
test("Studio newly-created current preview matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLog(
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111113/preview",
);
@@ -132,7 +136,7 @@ test("Studio newly-created current preview matches the source without a mask", a
test("Studio unpublish confirmation matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLog(page, "/studio/publications");
await gotoTechLogStudio(page, "/studio/publications");
await page
.getByRole("button", {
name: /컬렉션 Fetch Join과 페이징은 왜 충돌하는가 게시 취소/,
@@ -148,7 +152,7 @@ test("Studio warning acknowledgement publish state matches the source without a
page,
}) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLog(
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111116/validation",
);