docs: add a Next.js guide page
Merged
KD
5d ago+786+786+012345678901234567890123456789-77-77-01234567890123456789
A Next.js developer had to collect the setup from web.mdx, cache.mdx, the skill, and the example. docs/frameworks/nextjs.mdx puts it on one page, from e2e init to CI.
- One config for both modes (
docs/examples/nextjs/e2e.config.ts, typechecked):next devwithreuseExistinglocally,next startwhenCIis set, withnext buildbeforee2e run. The config readsCIthe way e2e does (packages/core/src/internal/env.ts:10):CI=0andCI=falsemean a local run. - Fix Next.js problems: three accordions.
- The
allowedDevOriginshydration fix moves here fromweb.mdx, which now links to it. - The App Router's empty
role="alert"route announcer, whichgetByRole('alert')also matches. - A webpack
watchOptions.ignoredentry for.e2e/.
- The
- Start a new app:
create-next-app --example ā¦/examples/with-nextfor npm, pnpm, and bun, and the Next.js with e2e template for Vercel. - Navigation and links: the page goes under Platforms, after Web.
web.mdx,cache.mdx, andexample-projects.mdxlink to it.docs/ja/anddocs/zh/get the page and the same link edits. - Skill:
skills/e2e/references/setup.mdcarries the same guidance (plugin copy synced), with apatchchangeset fore2e, since the skill ships in the package.
Issue
Closes ENG-1378
Verified
Ran it locally: yes. The steps on the page ran with the published e2e@0.23.1, @e2e-dev/web@0.16.0, and Next.js 16.4.6, in fresh create-next-app projects.
| Step on the page | Result |
|---|---|
npx e2e init --yes, then the page's config with init's agents kept, npx e2e run | passes, next dev started (ready 1.98s) |
dev server already running, npx e2e run | reused it, passes |
npm run build, then CI=1 npx e2e run | next start started (ready 0.49s), passes |
CI=false and CI=0 | next dev started, as e2e reads them |
port 0 (127.0.0.1), a client counter test, no allowedDevOrigins | fails: the click never updates the counter, HMR WebSocket errors |
same, with allowedDevOrigins: ['127.0.0.1'] | passes |
getByRole('alert') on a page with no alert of its own | count 1: the route announcer |
next dev --webpack, a module under .e2e/ changes | rebuilds without the page's watchOptions, does not rebuild with them |
npx create-next-app --example https://github.com/e2e-inc/e2e/tree/main/examples/with-next, npm run test:e2e | 3 passed, 2 agent tests skipped without a key |
ā target "web" command at http://localhost:3000/ ready 1.98s
ā |web| tests/example.e2e.ts > app opens 460ms
Tests 1 passed (1)
Not verified:
- The
.e2e/rebuild loop itself. I could not reproduce it on Next.js 15.5 or 16.4, with or without Tailwind, on Turbopack or webpack, in a single run or against a reused dev server. So the accordion is a conditional fix ("whennext devrecompiles while the tests run"). Turbopack has no ignore option for it, so the page gives the webpack fix only. - The rendered page.
mint devrejects the customthemeindocs/docs.json, so I did not see it on the site.pnpm docs:checkcompiles every page as MDX and checks anchors, examples, package-manager tabs, and the ja and zh outlines.
Review (fresh context, gpt-6.2-sol): four findings, all fixed.
- The sample imported
ai, whichinitdoes not install for None. It now keepsinit's model import andagentsentry. - The port must match in both
devandstart. process.env.CIdisagreed with e2e onCI=0andCI=false.- The
watchOptionslist replaced existing rules without saying so.
Notes:
- ENG-1378 says "App Router route cache", but the fact in
cache.mdxis the route announcer. The page covers the announcer. - ENG-1379 (making
with-nexta proper starter) is still open. The command on the page already works. The generatedpackage.jsonkeeps the namee2e-example-with-next, which is ENG-1379's scope.
š¤ Generated with Claude Code