From d6867cc72aeb00808ca8b88e3f46c152650f790d Mon Sep 17 00:00:00 2001 From: Brian Love Date: Sun, 30 Aug 2026 07:42:37 -0700 Subject: [PATCH] test(website): fix the e2e main broke, and drop the obsolete next-env wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two related repairs to the website e2e lane: 1. Docs search spec: #865's a11y pass gave search results role="option", and an explicit ARIA role overrides the implicit button role — so getByRole('button') stopped matching and main's website e2e has been red since. The spec now queries role 'option'. (Verified the failure reproduces identically on pristine main before touching anything.) 2. run-e2e-with-next-env-restore.ts existed to rewrite next-env.d.ts to canonical content after e2e, protecting a then-tracked file from dirty- tree churn. #862 untracked the file, and the dangling dev-path content the wrapper guarded against breaks nothing today — verified by writing that exact content with the referenced path absent: lint 0, test 0, build 0 (website has no typecheck target, and build regenerates the file first). The e2e target now runs the playwright executor directly; the wrapper and its extra target indirection are gone. Website e2e: 49/49 with the folded target. Co-Authored-By: Claude Opus 5 --- apps/website/e2e/docs.spec.ts | 4 +- apps/website/project.json | 6 --- .../scripts/run-e2e-with-next-env-restore.ts | 48 ------------------- 3 files changed, 3 insertions(+), 55 deletions(-) delete mode 100644 apps/website/scripts/run-e2e-with-next-env-restore.ts diff --git a/apps/website/e2e/docs.spec.ts b/apps/website/e2e/docs.spec.ts index fe2181fde..89664227e 100644 --- a/apps/website/e2e/docs.spec.ts +++ b/apps/website/e2e/docs.spec.ts @@ -147,7 +147,9 @@ test.describe('Docs search', () => { const searchInput = page.locator('input[placeholder*="Search"], input[type="search"]').first(); await searchInput.fill('choosing adapter'); - await expect(page.getByRole('button', { name: /Choosing an adapter/i })).toBeVisible(); + // Search results are role="option" inside the listbox (a11y pass, #865) — + // an explicit ARIA role overrides the implicit button role. + await expect(page.getByRole('option', { name: /Choosing an adapter/i })).toBeVisible(); await expect(page.getByText('No results found')).toHaveCount(0); }); }); diff --git a/apps/website/project.json b/apps/website/project.json index 2ca57e579..f14abd9a8 100644 --- a/apps/website/project.json +++ b/apps/website/project.json @@ -70,12 +70,6 @@ } }, "e2e": { - "executor": "nx:run-commands", - "options": { - "command": "npx tsx apps/website/scripts/run-e2e-with-next-env-restore.ts -- npx nx run website:e2e-playwright --skip-nx-cache" - } - }, - "e2e-playwright": { "executor": "@nx/playwright:playwright", "options": { "config": "apps/website/playwright.config.ts" diff --git a/apps/website/scripts/run-e2e-with-next-env-restore.ts b/apps/website/scripts/run-e2e-with-next-env-restore.ts deleted file mode 100644 index aeeaf9603..000000000 --- a/apps/website/scripts/run-e2e-with-next-env-restore.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { spawn } from 'node:child_process'; -import { writeFile } from 'node:fs/promises'; -import { fileURLToPath } from 'node:url'; - -const CANONICAL_NEXT_ENV = `/// -/// -import "./../../dist/apps/website/.next/types/routes.d.ts"; - -// NOTE: This file should not be edited -// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. -`; - -async function restoreNextEnv(): Promise { - await writeFile(new URL('../next-env.d.ts', import.meta.url), CANONICAL_NEXT_ENV); -} - -function run(command: string, args: string[]): Promise { - return new Promise((resolve, reject) => { - const child = spawn(command, args, { stdio: 'inherit' }); - child.on('error', reject); - child.on('close', (code) => resolve(code)); - }); -} - -async function main(): Promise { - const separator = process.argv.indexOf('--'); - const commandLine = separator === -1 ? process.argv.slice(2) : process.argv.slice(separator + 1); - const [command, ...args] = commandLine; - - if (!command) { - throw new Error('Expected a command after --'); - } - - let exitCode: number | null = 1; - try { - exitCode = await run(command, args); - } finally { - await restoreNextEnv(); - } - process.exitCode = exitCode ?? 1; -} - -if (process.argv[1] === fileURLToPath(import.meta.url)) { - main().catch((error: unknown) => { - console.error(error); - process.exitCode = 1; - }); -}