Skip to content

test(website): scope the shared docs page heading check to the article - #1614

Open
blove wants to merge 1 commit into
mainfrom
blove/website-e2e-docs-h1-locator
Open

blove wants to merge 1 commit into
mainfrom
blove/website-e2e-docs-h1-locator

Conversation

@blove

@blove blove commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Why

Website — e2e (control-plane) failed on #1609 (run 43773295008, attempt 1) in react-docs-parity.spec.ts:49 with a strict-mode violation: locator('h1') resolved to two <h1 id="choosing-an-adapter">, one hidden. It passed on rerun. The PR's diff did not touch the website.

Cause

A race that exists only under next dev, which is what this suite runs against:

  1. MdxRenderer wraps the article in <Suspense> in development only (the workaround for the React hydration replay bug). The article therefore streams after the shell into a hidden <div hidden id="S:0"> holder, which sits outside <article>.
  2. React's inline $RC script queues that holder and swaps it in later, on the next animation frame or on a timer of up to about 300 ms.
  3. [data-workspace-shell] mounts during hydration. If it mounts before the swap, React renders the article on the client at its new position.
  4. Until the queued swap runs and removes the holder, the page has a visible h1 and the hidden one.

A probe with a MutationObserver saw the overlap in 8 of 18 loads of /docs/choosing-an-adapter on a local dev server, lasting about 20 ms each time. Production does not render the boundary and is not affected.

Change

Line 49 uses page.locator('article h1'), the locator the same file already uses at line 34. In the served HTML the S:0 holder is outside <article> and the boundary is inside it, so the scoped locator can match only the revealed or client-rendered heading.

Verification

  • Served HTML for the route: one <article>, closed before the S:0 holder; the only streamed h1 is inside the holder.
  • The spec repeated 20 times against a single local next dev with BASE_URL set: with the change, 12 passed and none failed at line 49; without it, 13 passed and 2 failed at line 49 with the strict-mode violation. The other failures in both runs were timeouts earlier in the test, inside the selectFramework fixture, on my machine.
  • Not run: the full website:e2e-control-plane target with its own servers.

Not changed: library-pages.spec.ts:12 and editorial-pages.spec.ts:13 also use a bare page.locator('h1'); whether those routes go through the same boundary was not checked.

🤖 Generated with Claude Code

Under next dev the article streams into a hidden holder outside <article>
and is swapped in later. When the workspace shell mounts first, the article
is rendered again on the client, so for a moment the page has two h1
elements and a bare h1 locator fails Playwright's strict mode.
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
threadplane Ready Ready Preview Nov 16, 2026 5:57am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview – threadplane — 509f4197 Deployed Nov 16, 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