Skip to content

test(e2e): settle redirected locale routes in a fresh document - #977

Merged
owjs3901 merged 1 commit into
mainfrom
test/landing-dev-refresh-networkidle
Nov 15, 2026
Merged

owjs3901 merged 1 commit into
mainfrom
test/landing-dev-refresh-networkidle

Conversation

@owjs3901

Copy link
Copy Markdown
Contributor

Summary

e2e/landing-dev.spec.ts:47의 renders /ko/docs/features without a dev overlay or lazy import failure가 관련 없는 PR(#910, #915, #974)에서 계속 실패하던 문제를 고칩니다. 원인은 페이지가 느려서가 아니라 HTML refresh 리다이렉트와 Playwright networkidle 사이의 경쟁 조건입니다.

근본 원인

  • /ko/docs/features는 번역본이 없어서 [locale]/[[...slug]]/page.tsx가 한국어 SiteLayout 전체와 <meta http-equiv="refresh" content="0;url=/docs/features">를 렌더링합니다.
  • Vite dev에서는 이 한국어 문서가 모듈 수백 개를 불러오는 중에 refresh가 시작됩니다. /docs/features는 이 시점에 cold 상태라 렌더링이 오래 걸리고(CI: GET /docs/features 200 in 796ms (render: 731ms)), 그래서 새 문서는 이전 문서가 아직 모듈을 받는 도중에 커밋됩니다.
  • 이때 이전 문서가 보낸 요청 중 일부가 Playwright에 늦게 도착합니다. 새 문서 커밋으로 in-flight 집합이 초기화된 뒤에 들어오므로 새 문서의 요청으로 집계되는데, Chromium은 이 요청에 finished/failed 이벤트를 끝내 보내지 않습니다. 결국 networkidle이 영원히 오지 않고 page.goto가 90초 타임아웃으로 끝납니다.
  • /ko → / 도 같은 구조입니다. 다만 /는 앞선 테스트에서 이미 warm 상태라 리다이렉트가 모듈 로딩 전에 끝나서 운 좋게 통과할 뿐입니다.

증거

  • PR fix(sheet): write a longhand after every shorthand that covers it #974 CI 로그(job 132842440449)를 보면 서버는 GET /ko/docs/features 200 in 113ms, 이어서 GET /docs/features 200 in 796ms로 정상 응답합니다. 그 뒤 90초 동안 서버 요청은 없고, 테스트는 navigating to ".../ko/docs/features", waiting until "networkidle"에서 타임아웃됩니다. 나머지 12개는 통과합니다.
  • 로컬(Windows, vinext dev)에서 기존 spec으로 같은 실패를 재현했습니다. trace의 network 기록은 다음과 같습니다.
    • 17408 /ko/docs/features 문서 요청
    • 17698 refresh로 /docs/features 요청(393ms 소요)
    • 18082 새 문서 커밋. 한국어 문서의 모듈 요청 18개가 abort됨(status -1, time 14)
    • 18097 lenis_react.js와 vinext 모듈 하나가 status -1, time -1로 남음. wall clock 기준으로는 커밋 전에 시작한 요청인데, Playwright에는 커밋 뒤에 등록됐고 끝내 완료되지 않음. 같은 URL을 새 문서가 다시 요청해서 200을 받은 기록은 따로 있음
  • 이전 커밋 25f0e8a95는 같은 증상을 "Build Errors MDX가 커서 컴파일이 느리다"고 보고 대상 페이지를 Features로 바꿨지만, 실제 원인은 그대로 남아 있었습니다.

수정

e2e/landing-dev.spec.ts에 open() 헬퍼를 추가했습니다.

  • route === target이면 기존과 같이 page.goto(route, { waitUntil: 'networkidle' })를 씁니다.
  • 리다이렉트되는 route는 다음 순서로 엽니다.
    1. goto(route, { waitUntil: 'commit' })로 원래 응답(200)을 받습니다.
    2. waitForURL(target, { waitUntil: 'load' })로 refresh가 실제로 영어 페이지에 도착하는지 확인합니다.
    3. about:blank를 거쳐 goto(target, { waitUntil: 'networkidle' })로 깨끗한 문서에서 다시 settle합니다.

이후 검증은 그대로입니다. dev overlay가 없어야 하고, main이 렌더링돼야 하고, 테마 토글이 동작해야 하고, console이나 page error가 없어야 합니다(lazy import 실패 포함). 타임아웃은 늘리지 않았습니다. 테스트 전용 변경이라 changepack은 넣지 않았습니다.

Test plan

  • 로컬에서 기존 spec: bunx playwright test -c playwright.landing-dev.config.ts → /ko/docs/features 90초 타임아웃 재현(1 failed / 12 passed)
  • 수정 후 같은 명령 3회 → 3회 모두 13 passed(30~37초)
  • bunx prettier --single-quote --no-semi --check e2e/landing-dev.spec.ts
  • CI Run Landing dev navigation tests(vinext)와 (Next) 단계

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@owjs3901
owjs3901 merged commit 20a4726 into main Nov 15, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant