Skip to content

test(e2e): fix flaky dictionary entry-navigation specs - #1

Open
Abudora-0 wants to merge 1 commit into
mainfrom
claude/focused-goldstine-8b331c
Open

Abudora-0 wants to merge 1 commit into
mainfrom
claude/focused-goldstine-8b331c

Conversation

@Abudora-0

Copy link
Copy Markdown
Owner

Problem

Two specs in e2e/dictionary.spec.ts failed consistently in a sandboxed CI-like environment:

  • search > goes to the entry for the word and language chosen
  • search > submits on enter, without reaching for the button

Both fill the word field on /dictionary, submit, and assert expect(page).toHaveURL(/\/dictionary\/en\/<word>$/) within Playwright's default 5s timeout. The failure was always Received string: http://127.0.0.1:3123/dictionary — the client-side router.push in DictionarySearch had not settled when the assertion timed out.

Root cause: the target route apps/web/src/app/dictionary/[lang]/[word]/page.tsx is a Server Component that calls the dictionary provider chain directly (no mockable /api/dictionary/... route to intercept). A client-side navigation there triggers a real, live, unmocked upstream fetch, and the App Router only updates the URL once the RSC payload resolves. When upstream is slow, that legitimately exceeds 5s. This is a test-design gap, not a product bug — the feature works (verified manually and by provider-chain unit tests).

Fix

@live specs are never executed in CI (ci.yml runs npm run e2e only; there is no e2e:live job), so tagging these @live would drop the navigation coverage from CI entirely. Instead, the four specs that land on an entry route now get a 20s toHaveURL window via a shared ENTRY_NAV constant, with a comment explaining why. This absorbs upstream latency while keeping the specs in the default run.

The two extra specs (percent encodes a non Latin word into the URL, carries the suggestion's own language) were latent flakes with the identical cause — a suggestion-button click also router.pushes to an entry route. Runs showed them taking up to ~21s.

Verification

npm run e2e -- e2e/dictionary.spec.ts --repeat-each=3, run multiple times. All entry-navigation specs pass every repeat; observed durations up to ~21s confirm the widened window is what absorbs the real upstream latency.

The dictionary search specs assert only on the client side navigation,
but landing on a /dictionary/[lang]/[word] route makes the server render
it, and that calls the provider chain directly with no HTTP route to
intercept. So router.push settles only once a real upstream answers,
which can take well over the 5s default in a sandboxed CI-like
environment and fails the assertion even though the feature works.

@LiVe specs are never run in CI, so tagging these would drop the
navigation coverage entirely. Instead give the four specs that land on
an entry route a 20s window, which absorbs the upstream latency while
keeping them in the default run.
@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wakaru Ready Ready Preview Sep 7, 2026 6:05am UTC

This branch was successfully deployed

1 active deployment
Preview — e9174c04 Deployed Sep 7, 2026 by vercel[bot]
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