운영 안정화와 화면 회귀 검증을 반영
Some checks failed
API contract / OpenAPI type drift (push) Failing after 6m2s

This commit is contained in:
Yun Chan 2026-10-20 16:33:48 +09:00
parent 6e3123091a
commit aeddaa6972
69 changed files with 3178 additions and 424 deletions

View file

@ -38,7 +38,10 @@ const GATE_WIDTHS = [
{ width: 1440, height: 900, label: "1440-desktop" },
] as const;
const SHOT_DIR = path.join(process.cwd(), "node_modules", ".tmp", "layout-gate");
const SHOT_DIR = path.resolve(
process.cwd(),
process.env.LAYOUT_GATE_SHOT_DIR ?? path.join("node_modules", ".tmp", "layout-gate"),
);
const TEACHER_REVIEW_SESSION_ID = "teacher-review-visual";
function teacherAnalysisFixture() {
@ -486,20 +489,47 @@ async function auditClipping(page: Page): Promise<ClipReport> {
".vg-btn",
].join(",");
// Walks ancestors to find the nearest box that clips overflow. Returns the
// clipping rect when that ancestor is NOT scrollable (i.e. content cut off,
// not reachable by scrolling). A scrollable carousel (overflow auto/scroll)
// legitimately holds off-screen children, so it is treated as non-clipping.
// X-axis only: offender detection compares horizontal edges, so only the
// horizontal overflow behaviour of ancestors matters. A horizontal carousel
// (overflow-x auto/scroll) holds reachable off-screen children and is fine;
// overflow-x hidden genuinely cuts content off.
// fixed 요소는 transform 등의 fixed containing block 조상이 없다면 viewport를
// 기준으로 한다. 그 사이의 평범한 overflow 조상은 실제 clip이 아니므로 건너뛴다.
// 다만 fixed containing block을 만드는 조상부터는 기존 hard-clip 판정을 유지한다.
function establishesFixedContainingBlock(style: CSSStyleDeclaration): boolean {
const contain = style.contain.toLowerCase().split(/\s+/);
const willChange = style.willChange
.toLowerCase()
.split(",")
.map((value) => value.trim());
const establishesThroughWillChange = willChange.some((value) =>
["transform", "perspective", "filter", "backdrop-filter", "contain", "content-visibility"].includes(value),
);
return (
style.transform !== "none" ||
style.perspective !== "none" ||
style.filter !== "none" ||
style.getPropertyValue("backdrop-filter") !== "none" ||
contain.some((value) => ["layout", "paint", "strict", "content"].includes(value)) ||
style.contentVisibility === "auto" ||
establishesThroughWillChange
);
}
// 가장 가까운 hard clip을 찾는다. scroll 가능한 carousel은 화면 밖의 자식에게
// 도달할 수 있으므로 clip으로 보지 않는다. 가로 축만 검사한다.
function nearestHardClip(el: HTMLElement): DOMRect | null {
let viewportFixed = window.getComputedStyle(el).position === "fixed";
let node: HTMLElement | null = el.parentElement;
while (node && node !== document.body && node !== document.documentElement) {
const ox = window.getComputedStyle(node).overflowX;
const style = window.getComputedStyle(node);
const fixedPositioningAncestor = style.position === "fixed";
const establishesContainingBlock = viewportFixed && establishesFixedContainingBlock(style);
const ox = style.overflowX;
if (viewportFixed && !establishesContainingBlock) {
node = node.parentElement;
continue;
}
if (ox === "auto" || ox === "scroll") return null; // reachable by scroll
if (ox === "hidden" || ox === "clip") return node.getBoundingClientRect();
if (establishesContainingBlock) viewportFixed = false;
if (fixedPositioningAncestor) viewportFixed = true;
node = node.parentElement;
}
return null;
@ -568,6 +598,64 @@ async function auditClipping(page: Page): Promise<ClipReport> {
});
}
test.describe("fixed containing block clip 회귀", () => {
test("viewport-fixed 버튼은 평범한 overflow 조상 밖에서도 hit-test 가능", async ({ page }) => {
await page.setViewportSize({ width: 720, height: 180 });
await page.setContent(`
<style>html, body { margin: 0; }</style>
<main style="width: 524px; height: 120px; overflow: hidden;">
<button id="viewport-fixed" style="position: fixed; left: 25px; right: 25px; top: 20px; height: 48px;">시작</button>
</main>
`);
const report = await auditClipping(page);
expect(report.offenders).toEqual([]);
const hitTargets = await page.evaluate(() =>
[30, 520, 540, 690].map((x) => document.elementFromPoint(x, 44)?.id ?? null),
);
expect(hitTargets).toEqual(["viewport-fixed", "viewport-fixed", "viewport-fixed", "viewport-fixed"]);
});
test("일반 overflow 조상의 화면 밖 버튼은 계속 clip 실패", async ({ page }) => {
await page.setContent(`
<style>html, body { margin: 0; }</style>
<main style="position: relative; width: 524px; height: 120px; overflow: hidden;">
<button style="position: absolute; left: 600px; top: 20px; width: 100px; height: 48px;">잘림</button>
</main>
`);
const report = await auditClipping(page);
expect(report.offenders).toHaveLength(1);
expect(report.offenders[0]?.reason).toContain("clipped-by-ancestor");
});
test("transform containing block 내부 fixed 버튼은 clip 실패", async ({ page }) => {
await page.setContent(`
<style>html, body { margin: 0; }</style>
<main style="transform: translateZ(0); width: 524px; height: 120px; overflow: hidden;">
<button style="position: fixed; left: 600px; top: 20px; width: 100px; height: 48px;">잘림</button>
</main>
`);
const report = await auditClipping(page);
expect(report.offenders).toHaveLength(1);
expect(report.offenders[0]?.reason).toContain("clipped-by-ancestor");
});
test("fixed 영역 내부의 일반 버튼 hard clip은 계속 실패", async ({ page }) => {
await page.setContent(`
<style>html, body { margin: 0; }</style>
<main style="position: fixed; width: 524px; height: 120px; overflow: hidden;">
<button style="position: absolute; left: 600px; top: 20px; width: 100px; height: 48px;">잘림</button>
</main>
`);
const report = await auditClipping(page);
expect(report.offenders).toHaveLength(1);
expect(report.offenders[0]?.reason).toContain("clipped-by-ancestor");
});
});
async function gateScreen(
page: Page,
screen: string,