app-shell의 focus ring 시험이 FE-GATE-008 전체 실행에서 WebKit만 한 번 실패했다. 「플랫폼 구성」 heading이 5초 안에 나오지 않았다(단독 실행에서는 세 엔진 모두 통과). 시험은 page.goto 직후 링크에 focus()를 주고 Enter를 누른다. 홈 라우트는 셸보다 늦게 그려지므로, 그 전에 준 포커스는 바뀐 노드와 함께 사라지고 Enter는 아무것도 하지 않는다. 고른 방법: 홈 heading이 그려진 것을 기다린 뒤 포커스를 주고, 링크가 포커스를 가졌는지 확인한 뒤 Enter를 누른다. 버린 대안: 재시도나 timeout 늘리기(원인을 덮는다). 검증: 고치기 전 시험을 WebKit에서 30번, 고친 시험을 세 엔진에서 30번씩 돌린 결과를 PR 본문에 적는다. Refs: 1112/05-02
108 lines
4.3 KiB
TypeScript
108 lines
4.3 KiB
TypeScript
import { expect, test } from "../support/browser/strict-browser-test.ts";
|
|
|
|
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\/platform$/);
|
|
await expect(
|
|
page.getByRole("heading", { level: 1, name: "플랫폼 구성" }),
|
|
).toBeFocused();
|
|
});
|
|
|
|
// 1112/05-02. The route heading takes focus on every navigation. A keyboard
|
|
// user must see it (M2); a pointer user may not need the ring.
|
|
test("shows the focus ring on the route heading after keyboard navigation only", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/");
|
|
// The home route renders after the shell: focus given before it is there
|
|
// goes with the node it lands on, and Enter then does nothing (WebKit).
|
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Clean Architecture Frontend");
|
|
const link = page
|
|
.getByRole("navigation", { name: "주요 탐색" })
|
|
.getByRole("link", { name: "플랫폼 구성" });
|
|
await link.focus();
|
|
await expect(link).toBeFocused();
|
|
await page.keyboard.press("Enter");
|
|
const heading = page.getByRole("heading", { level: 1, name: "플랫폼 구성" });
|
|
await expect(heading).toBeFocused();
|
|
expect(await heading.evaluate((element) => getComputedStyle(element).outlineStyle)).not.toBe("none");
|
|
|
|
await page
|
|
.getByRole("navigation", { name: "주요 탐색" })
|
|
.getByRole("link", { name: "홈" })
|
|
.click();
|
|
const home = page.getByRole("heading", { level: 1 });
|
|
await expect(home).toBeFocused();
|
|
expect(await home.evaluate((element) => getComputedStyle(element).outlineStyle)).toBe("none");
|
|
});
|
|
|
|
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 expect(page.locator(".ui-drawer")).toHaveJSProperty("open", true);
|
|
expect(
|
|
await page.locator(".ui-drawer").evaluate((drawer) => drawer.matches(":modal")),
|
|
).toBe(true);
|
|
|
|
await page.keyboard.press("Escape");
|
|
await expect(menu).toHaveAttribute("aria-expanded", "false");
|
|
await expect(page.getByRole("navigation", { name: "주요 탐색" })).toBeHidden();
|
|
await expect(menu).toBeFocused();
|
|
});
|
|
|
|
// R3-6. A drawer link closes the modal drawer and changes the route in the
|
|
// same click. The drawer's deferred focus restore must not win over the new
|
|
// page's heading focus; Escape (no navigation) still returns to the menu.
|
|
test("moves focus to the new page after a mobile drawer link, not back to the menu", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await page.goto("/");
|
|
const menu = page.getByRole("button", { name: "메뉴", exact: true });
|
|
const navigation = page.getByRole("navigation", { name: "주요 탐색" });
|
|
|
|
await menu.click();
|
|
await navigation.getByRole("link", { name: "플랫폼 구성" }).click();
|
|
|
|
await expect(page).toHaveURL(/\/examples\/platform$/);
|
|
await expect(menu).toHaveAttribute("aria-expanded", "false");
|
|
const heading = page.getByRole("heading", { level: 1, name: "플랫폼 구성" });
|
|
await expect(heading).toBeFocused();
|
|
// Give any late restore (dialog close timer, lazy route commit) time to run.
|
|
await page.waitForTimeout(300);
|
|
expect(
|
|
await page.evaluate(() => {
|
|
const active = document.activeElement;
|
|
return active?.matches("h1, main") === true;
|
|
}),
|
|
).toBe(true);
|
|
await expect(menu).not.toBeFocused();
|
|
|
|
await menu.click();
|
|
await expect(navigation).toBeVisible();
|
|
await page.keyboard.press("Escape");
|
|
await expect(navigation).toBeHidden();
|
|
await expect(menu).toBeFocused();
|
|
});
|