From 52402a4e16e3bbd6b54a46cd46f466b42d503edb Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Mon, 16 Nov 2026 00:23:00 +0900 Subject: [PATCH] test(e2e): settle redirected locale routes in a fresh document An untranslated localized route renders the full Korean layout plus an HTML refresh to the English page. On a cold dev server the English page takes several hundred milliseconds to render, so the refresh commits while the Korean document is still fetching its Vite modules. Chromium never reports some of those aborted requests as finished, Playwright counts them against the English document, and networkidle never fires, so page.goto(route, { waitUntil: 'networkidle' }) times out. Follow the refresh up to the English page's load event, then open the target from about:blank and wait for networkidle there. Routes that do not redirect keep the direct networkidle navigation. Co-Authored-By: Claude Opus 5.5 --- e2e/landing-dev.spec.ts | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/e2e/landing-dev.spec.ts b/e2e/landing-dev.spec.ts index 9dfe923ab..99484cf16 100644 --- a/e2e/landing-dev.spec.ts +++ b/e2e/landing-dev.spec.ts @@ -1,4 +1,4 @@ -import { expect, test as base } from '@playwright/test' +import { expect, type Page, test as base } from '@playwright/test' const test = base.extend<{ browserErrors: string[] }>({ browserErrors: [ @@ -43,11 +43,30 @@ const routes = [ ['/ko/docs/features', '/docs/features'], ] as const +/** + * An untranslated localized route answers with an HTML refresh to the English + * page. The refresh replaces the localized document while it is still loading + * its dev modules, and Chromium never reports some of the requests it aborts as + * finished, so Playwright counts them against the English document and + * networkidle never fires there. Follow the refresh, then settle the target in + * a fresh document. + */ +async function open(page: Page, route: string, target: string) { + if (route === target) { + return page.goto(route, { waitUntil: 'networkidle' }) + } + const response = await page.goto(route, { waitUntil: 'commit' }) + await page.waitForURL(`http://localhost:3098${target}`, { waitUntil: 'load' }) + await page.goto('about:blank') + await page.goto(target, { waitUntil: 'networkidle' }) + return response +} + for (const [route, target] of routes) { test(`renders ${route} without a dev overlay or lazy import failure`, async ({ page, }) => { - const response = await page.goto(route, { waitUntil: 'networkidle' }) + const response = await open(page, route, target) expect(response?.status()).toBe(200) await expect(page).toHaveURL(`http://localhost:3098${target}`)