셸 동작을 보는 e2e(반응형, 스크롤 복원, 해시 링크, 타이포그래피, 건너뛰기 링크, 메뉴 이동, 운영 CSP, compact, en-US의 lang)가 지울 예제 화면을 열거나 그 메뉴를 누른다. 홈과 /examples/platform으로 옮겼다. 스크롤 복원은 계약 표가 그려진 뒤 스크롤하고, 해시 링크는 비동기 표보다 위에 있는 첫 절을 대상으로 한다. WebKit은 scroll anchoring이 없어 표 아래 대상이 1px 밀렸다. 갤러리 자체의 320px 리플로는 앞 커밋의 workshop 시험이 맡는다. 위험: 홈과 플랫폼 개요의 모양이 바뀌면 이 시험들의 대상도 바뀐다. 검증(desktop): 샘플을 지운 최종 트리에서 test:e2e 183 passed.
45 lines
1.9 KiB
TypeScript
45 lines
1.9 KiB
TypeScript
import { expect, test, type Page } from "../support/browser/strict-browser-test.ts";
|
|
|
|
const scrollY = (page: Page) => page.evaluate(() => Math.round(window.scrollY));
|
|
|
|
// 08-08. Back restores where the user was; a new route starts at the top.
|
|
// The platform overview is the template's long page; its contract tables
|
|
// fill in after the title, so the test waits for them before it scrolls.
|
|
test("restores the scroll position when navigating back", async ({ page }) => {
|
|
const heading = page.getByRole("heading", { level: 1 });
|
|
await page.goto("/examples/platform");
|
|
await expect(heading).toHaveText("플랫폼 구성");
|
|
await expect(page.locator("main [aria-busy='true']")).toHaveCount(0);
|
|
await page.evaluate(() => window.scrollTo(0, 900));
|
|
await expect.poll(() => scrollY(page)).toBe(900);
|
|
|
|
await page
|
|
.getByRole("navigation", { name: "주요 탐색" })
|
|
.getByRole("link", { name: "홈" })
|
|
.click();
|
|
await expect(heading).toHaveText("Clean Architecture Frontend");
|
|
await expect.poll(() => scrollY(page)).toBe(0);
|
|
|
|
await page.goBack();
|
|
await expect(heading).toHaveText("플랫폼 구성");
|
|
await expect.poll(() => scrollY(page)).toBe(900);
|
|
});
|
|
|
|
// The first section: the contract tables below it fill in after the page
|
|
// draws, and WebKit, which has no scroll anchoring, moves a target below them.
|
|
test("opens a hash link at its target below the sticky header", async ({
|
|
page,
|
|
}) => {
|
|
await page.goto("/examples/platform#platform-release-title");
|
|
const target = page.locator("#platform-release-title");
|
|
await expect(target).toBeInViewport();
|
|
const top = await target.evaluate((element) =>
|
|
Math.round(element.getBoundingClientRect().top),
|
|
);
|
|
const headerBottom = await page
|
|
.locator(".app-shell__header")
|
|
.evaluate((element) => Math.round(element.getBoundingClientRect().bottom));
|
|
expect(top).toBeGreaterThanOrEqual(headerBottom);
|
|
expect(await scrollY(page)).toBeGreaterThan(0);
|
|
});
|