From 0c116bef141bab3b2bd45b77e258232e0ae0dd21 Mon Sep 17 00:00:00 2001 From: BASICBIT Date: Sat, 30 May 2026 19:02:47 -0400 Subject: [PATCH] Include mutation flow in local E2E --- apps/web/package.json | 2 +- apps/web/playwright.config.mjs | 11 ++++++++++- docs/testing/playwright-visual-preview.md | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index 20edac9..fc50fdb 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -12,7 +12,7 @@ "check:vercel-env": "node ./scripts/check-vercel-env.mjs", "start": "next start", "lint": "eslint", - "test:e2e": "playwright test --grep-invert \"@visual|@flow|@snapshot\"", + "test:e2e": "playwright test --grep-invert \"@visual|@snapshot\"", "test:e2e:hosted": "playwright test --grep @flow --project=desktop-chromium", "test:e2e:hosted:smoke": "playwright test --grep-invert \"@visual|@flow|@snapshot\"", "test:e2e:snapshots": "playwright test --grep @snapshot", diff --git a/apps/web/playwright.config.mjs b/apps/web/playwright.config.mjs index 27615b0..07212b6 100644 --- a/apps/web/playwright.config.mjs +++ b/apps/web/playwright.config.mjs @@ -15,9 +15,17 @@ const reuseConvexServer = process.env.PLAYWRIGHT_REUSE_CONVEX === "true"; const skipWebServers = process.env.PLAYWRIGHT_SKIP_WEBSERVERS === "true" || Boolean(hostedBaseURL); const skipConvexServer = skipWebServers || process.env.PLAYWRIGHT_SKIP_CONVEX_DEV === "true"; const recordVideo = process.env.PLAYWRIGHT_RECORD_VIDEO === "true"; +const e2eHelpersEnabled = process.env.VRDEX_ENABLE_E2E_HELPERS ?? (hostedBaseURL ? undefined : "true"); const allowFixtureSearchFallthrough = process.env.VRDEX_ALLOW_PLAYWRIGHT_FIXTURE_SEARCH_FALLTHROUGH === "true" || - process.env.VRDEX_ENABLE_E2E_HELPERS === "true"; + e2eHelpersEnabled === "true"; +const localE2eHelperEnv = hostedBaseURL + ? {} + : { + VRDEX_ENABLE_E2E_HELPERS: e2eHelpersEnabled ?? "true", + VRDEX_E2E_BROWSER_TOKEN: process.env.VRDEX_E2E_BROWSER_TOKEN ?? "local-playwright-token", + VRDEX_E2E_CONVEX_SECRET: process.env.VRDEX_E2E_CONVEX_SECRET ?? "local-convex-e2e-secret", + }; if (!hostedBaseURL) { process.env.CONVEX_URL = convexUrl; @@ -29,6 +37,7 @@ const sharedEnv = { CONVEX_URL: convexUrl, NEXT_PUBLIC_CONVEX_URL: convexUrl, VRDEX_ENABLE_PLAYWRIGHT_FIXTURES: "true", + ...localE2eHelperEnv, ...(allowFixtureSearchFallthrough ? { VRDEX_ALLOW_PLAYWRIGHT_FIXTURE_SEARCH_FALLTHROUGH: "true" } : {}), diff --git a/docs/testing/playwright-visual-preview.md b/docs/testing/playwright-visual-preview.md index 061f01a..c42ab2c 100644 --- a/docs/testing/playwright-visual-preview.md +++ b/docs/testing/playwright-visual-preview.md @@ -6,7 +6,7 @@ See `docs/testing/playwright-image-diffing.md` for the committed-baseline image ## Local commands -- Smoke public routes: `pnpm test:e2e` +- Smoke public routes and run the local mutation-backed data flow: `pnpm test:e2e` - Capture public route screenshots: `pnpm test:e2e:visual` - Compare public route screenshots against baselines: `pnpm test:e2e:snapshots` - Update public route screenshot baselines: `pnpm test:e2e:snapshots:update` @@ -50,7 +50,7 @@ POSIX shell hosted production smoke run: PLAYWRIGHT_BASE_URL=https://vrdex.net PLAYWRIGHT_SKIP_WEBSERVERS=true pnpm test:e2e:hosted:smoke ``` -The visual suite starts a local Convex backend and Next dev server by default. Setting `PLAYWRIGHT_BASE_URL` switches Playwright to hosted mode and disables local web servers. Profile screenshots use deterministic Next-server fixtures when `VRDEX_ENABLE_PLAYWRIGHT_FIXTURES=true`, while `/server-status` still exercises the real local Convex health query. Fixture profiles are disabled when `NODE_ENV=production`. +The local Playwright suite starts a local Convex backend and Next dev server by default. Setting `PLAYWRIGHT_BASE_URL` switches Playwright to hosted mode and disables local web servers. Local webserver runs set token-gated E2E helper defaults so `pnpm test:e2e` includes the mutation-backed `@flow` journey without additional env setup. Profile screenshots use deterministic Next-server fixtures when `VRDEX_ENABLE_PLAYWRIGHT_FIXTURES=true`, while `/server-status` still exercises the real local Convex health query. Fixture profiles are disabled when `NODE_ENV=production`. ## Captured routes