Files
tech-log-frontend/tests/visual/tech-log.visual.spec.ts
T
DongHyeonka f3a4e83b7e test(visual): 모르는 slug 화면이 SPA 안의 not-found를 찍는다
visual의 「unknown Public …」 20건은 /projects/missing-project 같은 경로가
서버의 평문 「Not Found」를 받는다고 기대하고, 그것을 찍는다. 6784eb1
(08-20)부터 서버는 등록된 Public 경로 패턴이면 SPA를 내고, 게시되지 않은
slug는 화면 안의 not-found(「페이지를 찾을 수 없습니다.」)가 된다. 그래서
글자를 찾지 못해 스크린샷 전에 떨어진다.

화면 안의 not-found h1과 site-frame을 확인하고 찍는다. 경로가 없는
NOT_FOUND의 평문 응답 visual은 그대로다. 기준 이미지는 visual 기준 갱신
커밋에서 새로 만든다.
2026-11-12 18:38:30 +09:00

180 lines
6.9 KiB
TypeScript

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,
TECH_LOG_STUDIO_STATE_PATHS,
TECH_LOG_UNKNOWN_PUBLIC_PATHS,
} from "../support/browser/tech-log-fixtures.ts";
function fixtureSnapshotName(path: string) {
return `tech-log-public-fixture-${path.slice(1).replaceAll("/", "-")}-1440.png`;
}
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 (route.layout === "STUDIO" ? gotoTechLogStudio : gotoTechLog)(
page,
route.path,
);
await expect(page).toHaveScreenshot(`${route.routeId.toLowerCase()}-${width}.png`, {
fullPage: true,
});
});
}
}
for (const path of TECH_LOG_PUBLIC_FIXTURE_PATHS) {
test(`known Public fixture ${path} matches its reviewed wide visual`, async ({
page,
}) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLog(page, path);
await expect(page).toHaveScreenshot(fixtureSnapshotName(path), {
fullPage: true,
});
});
}
for (const width of TECH_LOG_BREAKPOINT_WIDTHS) {
test(`Public home matches the reviewed ${width}px breakpoint visual`, async ({ page }) => {
await page.setViewportSize({ width, height: 1000 });
await gotoTechLog(page, "/");
await expect(page).toHaveScreenshot(`tech-log-home-breakpoint-${width}.png`, {
fullPage: true,
});
});
}
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 gotoTechLogStudio(page, path);
await expect(page).toHaveScreenshot(`tech-log-studio-${state}-1440.png`, {
fullPage: true,
});
});
}
// 6784eb1 (08-20). The server serves every registered Public route pattern,
// so a slug nobody published gets the SPA and its in-shell not-found page,
// not the edge's plain-text "Not Found" (that stays for paths no route
// declares: NOT_FOUND above).
for (const [route, path] of TECH_LOG_UNKNOWN_PUBLIC_PATHS) {
for (const width of [360, 1440] as const) {
test(`unknown Public ${route} shows the in-shell not-found at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 1000 });
await gotoTechLog(page, path);
await expect(
page.getByRole("heading", { level: 1, name: "페이지를 찾을 수 없습니다." }),
).toBeVisible();
await expect(page.locator(".site-frame")).toHaveCount(1);
await expect(page).toHaveScreenshot(`tech-log-unknown-${route}-${width}.png`, {
fullPage: true,
});
});
}
}
test("open Public search dialog matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await gotoTechLog(page, "/");
await page.getByRole("button", { name: "검색 열기" }).click();
await expect(page.getByRole("dialog", { name: "검색" })).toBeVisible();
await expect(page).toHaveScreenshot("tech-log-search-dialog-390.png", {
fullPage: true,
});
});
test("open Studio mobile menu matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await gotoTechLogStudio(page, "/studio");
await page.getByRole("button", { name: "Studio 메뉴 열기" }).click();
await expect(page).toHaveScreenshot("tech-log-studio-mobile-menu-390.png", {
fullPage: true,
});
});
test("Studio immediate preview matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
await expect(page.getByRole("region", { name: "즉시 미리보기" })).toBeVisible();
await expect(page).toHaveScreenshot("tech-log-studio-immediate-preview-1440.png", {
fullPage: true,
});
});
test("Studio dirty-leave dialog matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
await page.getByLabel("요약").fill("저장하지 않은 시각 검증 변경");
await page
.getByRole("navigation", { name: "Studio 주 탐색" })
.getByRole("link", { name: "게시", exact: true })
.click();
await expect(
page.getByRole("dialog", { name: "저장하지 않은 변경" }),
).toBeVisible();
await expect(page).toHaveScreenshot("tech-log-studio-dirty-leave-dialog-1440.png", {
fullPage: true,
});
});
test("Studio newly-created current preview matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111113/preview",
);
await page.getByRole("button", { name: "Public Preview 만들기" }).click();
await expect(page.getByText("현재 저장 버전의 Public Preview입니다.")).toBeVisible();
await expect(page).toHaveScreenshot("tech-log-studio-current-preview-created-1440.png", {
fullPage: true,
});
});
test("Studio unpublish confirmation matches the source without a mask", async ({ page }) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLogStudio(page, "/studio/publications");
await page
.getByRole("button", {
name: /컬렉션 Fetch Join과 페이징은 왜 충돌하는가 게시 취소/,
})
.click();
await expect(page.getByRole("dialog", { name: "게시를 취소할까요?" })).toBeVisible();
await expect(page).toHaveScreenshot("tech-log-studio-unpublish-dialog-1440.png", {
fullPage: true,
});
});
test("Studio warning acknowledgement publish state matches the source without a mask", async ({
page,
}) => {
await page.setViewportSize({ width: 1440, height: 1000 });
await gotoTechLogStudio(
page,
"/studio/documents/11111111-1111-4111-8111-111111111116/validation",
);
await page.getByRole("button", { name: "검증하기" }).click();
await page.getByText("경고를 확인하고 Preview를 만들 수 있습니다").waitFor();
await page.getByRole("link", { name: "Public Preview 만들기" }).click();
await page.getByRole("button", { name: "Public Preview 만들기" }).click();
await page.getByText("현재 저장 버전의 Public Preview입니다.").waitFor();
await page.getByRole("link", { name: "게시 준비로 이동" }).click();
await page.getByRole("checkbox").check();
await expect(page.getByRole("button", { name: /게시$/ })).toBeEnabled();
await expect(page).toHaveScreenshot("tech-log-studio-warning-acknowledged-1440.png", {
fullPage: true,
});
});