61 lines
2.1 KiB
JavaScript
61 lines
2.1 KiB
JavaScript
import { expect, test } from "@playwright/test";
|
|
import { ROUTE_REGISTRY } from "../../src/features/installed-feature-contracts.js";
|
|
|
|
test("boots the public app shell", async ({ page }) => {
|
|
await page.goto("/");
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText(
|
|
"Clean Architecture Frontend",
|
|
);
|
|
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
|
|
await expect(page.getByRole("main")).toBeVisible();
|
|
});
|
|
|
|
test("navigates to a registry-backed example without a page reload", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/");
|
|
await page
|
|
.getByRole("navigation", { name: "주요 탐색" })
|
|
.getByRole("link", { name: "화면 상태" })
|
|
.click();
|
|
|
|
await expect(page).toHaveURL(/\/examples\/states$/);
|
|
await expect(
|
|
page.getByRole("heading", { level: 1, name: "화면 상태" }),
|
|
).toBeFocused();
|
|
});
|
|
|
|
test("opens the protected integration route through the local demo seam", async ({
|
|
page,
|
|
}) => {
|
|
const protectedRoute = Object.values(ROUTE_REGISTRY).find(
|
|
(definition) => definition.access === "integration-defined",
|
|
);
|
|
if (!protectedRoute) throw new Error("An integration route is required");
|
|
await page.goto(protectedRoute.path);
|
|
await expect(
|
|
page.getByRole("heading", { name: "세션이 필요합니다." }),
|
|
).toBeVisible();
|
|
|
|
await page.getByRole("button", { name: "로그인 시작" }).click();
|
|
|
|
await expect(
|
|
page.getByRole("heading", { name: protectedRoute.title }),
|
|
).toBeVisible();
|
|
await expect(page.getByText("인증됨")).toBeVisible();
|
|
});
|
|
|
|
test("provides an escape-dismissible mobile navigation", async ({ page }) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await page.goto("/");
|
|
const menu = page.getByRole("button", { name: "메뉴", exact: true });
|
|
|
|
await menu.click();
|
|
await expect(menu).toHaveAttribute("aria-expanded", "true");
|
|
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeVisible();
|
|
|
|
await page.keyboard.press("Escape");
|
|
await expect(menu).toHaveAttribute("aria-expanded", "false");
|
|
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeHidden();
|
|
});
|