From 9095c6337e7525e49606c16cce7f43a8295f52bf Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 17:18:28 +0900 Subject: [PATCH] =?UTF-8?q?test(e2e):=20=ED=85=9C=ED=94=8C=EB=A6=BF?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=98=A8=20=EC=8B=9C=ED=97=98=EC=9D=B4=20?= =?UTF-8?q?=EC=95=B1=EC=9D=B4=20=EA=B7=B8=EB=A0=A4=EC=A7=84=20=EB=92=A4?= =?UTF-8?q?=EB=B6=80=ED=84=B0=20=EC=9E=B0=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit scroll-restoration, production-csp, old-tab-chunk-recovery, boot-module-failure는 템플릿처럼 page.goto 뒤 첫 expect(5초) 안에 첫 화면이 그려지기를 기다린다. desktop 호스트의 WebKit은 화면 하나를 여는 데 혼자 돌 때도 3.8~4.6초가 걸린다(Case 화면, Chromium 0.93초). 그래서 다른 worker와 함께 돌면 5초를 넘겨 「불러오는 중」에서 떨어진다. 전체 test:e2e와 3회 반복에서 webkit만 이렇게 떨어졌다. 이 제품의 다른 브라우저 시험처럼 앱이 그려진 것(.site-frame, 부팅 실패면 alert)을 먼저 기다린다. scroll-restoration은 gotoTechLog로 연다. 시험하는 것(스크롤 위치, CSP, 다시 불러오기 횟수, 실패 화면 내용)은 그대로다. 부팅 실패 청크 수정 전후 WebKit 시간이 같아서(JS 14개일 때 3.8~4.6초, 36개일 때 3.8~4.1초) 청크 수가 원인은 아니다. 검증: 네 시험과 app-shell을 chromium·firefox·webkit에서 --repeat-each=3으로 81건 모두 통과. --- tests/e2e/boot-module-failure.spec.ts | 3 +++ tests/e2e/old-tab-chunk-recovery.spec.ts | 2 ++ tests/e2e/production-csp.spec.ts | 2 ++ tests/e2e/scroll-restoration.spec.ts | 9 +++++++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/e2e/boot-module-failure.spec.ts b/tests/e2e/boot-module-failure.spec.ts index cbbbbfe..74ebf8c 100644 --- a/tests/e2e/boot-module-failure.spec.ts +++ b/tests/e2e/boot-module-failure.spec.ts @@ -50,6 +50,9 @@ test("shows the boot error shell when a module throws while it evaluates", async await page.goto(`${server.origin}/`); const shell = page.getByRole("alert"); + // The boot error shell replaces the loading shell once the boot has + // failed; see scroll-restoration.spec.ts for why this is not a 5 s window. + await shell.waitFor(); await expect(shell).toContainText("애플리케이션을 시작할 수 없습니다."); await expect(shell).toContainText("BOOT_UNEXPECTED_FAILURE"); await expect(shell).toContainText("TypeError"); diff --git a/tests/e2e/old-tab-chunk-recovery.spec.ts b/tests/e2e/old-tab-chunk-recovery.spec.ts index bbf78e3..b7f51b8 100644 --- a/tests/e2e/old-tab-chunk-recovery.spec.ts +++ b/tests/e2e/old-tab-chunk-recovery.spec.ts @@ -93,6 +93,8 @@ test("an old tab reloads once into the new build, then stops reloading", async ( const server = await startBuildServer(builds.dist); try { await page.goto(`${server.origin}/`); + // The app draws after the document loads; see scroll-restoration.spec.ts. + await page.locator(".site-frame").waitFor(); await expect( page.getByRole("link", { name: PLATFORM.navigationLabel!, exact: true }), ).toBeVisible(); diff --git a/tests/e2e/production-csp.spec.ts b/tests/e2e/production-csp.spec.ts index 811ce0e..1ed1822 100644 --- a/tests/e2e/production-csp.spec.ts +++ b/tests/e2e/production-csp.spec.ts @@ -51,6 +51,8 @@ async function cspViolations(page: Page): Promise { test("boots and changes route under the production security headers", async ({ page }) => { const response = await page.goto("/"); + // The app draws after the document loads; see scroll-restoration.spec.ts. + await page.locator(".site-frame").waitFor(); expect(response?.headers()["content-security-policy"]).toBe( securityHeaders["Content-Security-Policy"], ); diff --git a/tests/e2e/scroll-restoration.spec.ts b/tests/e2e/scroll-restoration.spec.ts index f6b068e..7e4c979 100644 --- a/tests/e2e/scroll-restoration.spec.ts +++ b/tests/e2e/scroll-restoration.spec.ts @@ -1,9 +1,14 @@ import { expect, test, type Page } from "../support/browser/strict-browser-test.ts"; +import { gotoTechLog } from "../support/browser/tech-log-fixtures.ts"; const scrollY = (page: Page) => page.evaluate(() => Math.round(window.scrollY)); // Template sync (af3d8e6). Upstream scrolls its long example page; this product // deleted it, and a TechLog Case (about 6,000px at 1280x720) is the long page. +// Pages open through gotoTechLog, like the rest of this product's browser +// tests: it waits for the app to draw. After a bare page.goto the first +// expectation had 5 s for that, which WebKit on the desktop host sometimes +// needs more than while the other workers run. const LONG_PAGE = "/cases/collection-fetch-join-pagination"; const LONG_PAGE_TITLE = "컬렉션 Fetch Join과 페이징은 왜 충돌하는가"; @@ -12,7 +17,7 @@ const LONG_PAGE_TITLE = "컬렉션 Fetch Join과 페이징은 왜 충돌하는 // scrolls. test("restores the scroll position when navigating back", async ({ page }) => { const heading = page.getByRole("heading", { level: 1 }); - await page.goto(LONG_PAGE); + await gotoTechLog(page, LONG_PAGE); await expect(heading).toHaveText(LONG_PAGE_TITLE); await expect(page.locator("main [aria-busy='true']")).toHaveCount(0); await expect(page.locator("#remaining-cost")).toBeAttached(); @@ -38,7 +43,7 @@ test("restores the scroll position when navigating back", async ({ page }) => { test("opens a hash link at its target below the sticky header", async ({ page, }) => { - await page.goto(`${LONG_PAGE}#separate-loading`); + await gotoTechLog(page, `${LONG_PAGE}#separate-loading`); const target = page.locator("#separate-loading"); await expect(target).toBeInViewport(); const top = await target.evaluate((element) =>