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

42 lines
1.6 KiB
TypeScript

import { expect, test } from "../support/browser/strict-browser-test.ts";
import {
gotoTechLog,
horizontalOverflow,
TECH_LOG_BREAKPOINT_WIDTHS,
} from "../support/browser/tech-log-fixtures.ts";
for (const width of TECH_LOG_BREAKPOINT_WIDTHS) {
test(`Public shell has no overflow and preserves the ${width}px breakpoint contract`, async ({
page,
}) => {
await page.setViewportSize({ width, height: 900 });
await gotoTechLog(page, "/");
const dimensions = await horizontalOverflow(page);
expect(dimensions.scrollWidth).toBeLessThanOrEqual(dimensions.clientWidth);
if (width <= 1050) {
await expect(page.locator("details.mobile-nav > summary")).toBeVisible();
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeHidden();
} else {
await expect(page.locator("details.mobile-nav > summary")).toBeHidden();
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
}
});
}
for (const width of [1050, 1024, 980, 900, 820, 768, 767, 420, 390, 375] as const) {
test(`Studio editor has no overflow and preserves the ${width}px editor transition`, async ({
page,
}) => {
await page.setViewportSize({ width, height: 1000 });
await gotoTechLog(
page,
"/studio/documents/11111111-1111-4111-8111-111111111111/edit",
);
const dimensions = await horizontalOverflow(page);
expect(dimensions.scrollWidth).toBeLessThanOrEqual(dimensions.clientWidth);
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
await expect(page.getByRole("button", { name: "저장" })).toBeVisible();
});
}