Files
tech-log-frontend/tests/e2e/responsive.spec.ts
T

37 lines
1.3 KiB
TypeScript

import { expect, test } from "../support/browser/strict-browser-test.ts";
import {
gotoTechLog,
horizontalOverflow,
TECH_LOG_CANONICAL_ROUTES,
} from "../support/browser/tech-log-fixtures.ts";
for (const route of TECH_LOG_CANONICAL_ROUTES) {
for (const width of [360, 1440] as const) {
test(`${route.routeId} has no horizontal overflow at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 900 });
await gotoTechLog(page, route.path);
const dimensions = await horizontalOverflow(page);
expect(dimensions.scrollWidth).toBeLessThanOrEqual(dimensions.clientWidth);
if (route.routeId !== "NOT_FOUND") {
await expect(page.getByRole("main")).toBeVisible();
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
} else {
await expect(page.getByText("Not Found", { exact: true })).toBeVisible();
}
});
}
}
test("compact Public controls retain 44px targets", async ({ page }) => {
await page.setViewportSize({ width: 375, height: 812 });
await gotoTechLog(page, "/");
await expect(page.locator("details.mobile-nav > summary")).toHaveCSS(
"min-height",
"44px",
);
await expect(page.getByRole("button", { name: "검색 열기" })).toHaveCSS(
"min-height",
"44px",
);
});