From 8f6cdcea5fd1122c51470b8a727680c1009b718f Mon Sep 17 00:00:00 2001 From: Cameron Reeves Date: Wed, 4 Nov 2026 10:38:43 +1100 Subject: [PATCH] fix(e2e): turn Sentry off in the Workplace e2e dev server 24cc8b5bf8 turned Sentry on by default, so every Workplace page the e2e suite loads now posts envelopes to ingest.us.sentry.io. The settings specs refuse any request that leaves the local app and backend: the read-only guard records the POST to /api//envelope/ as an API mutation, and the browser-only harness records it as an external HTTP request. On develop that failed 411 settings tests and 18 of 36 browser-only tests, and every run sent events from localhost to the placeos-dev project. Sentry reads sentry_dsn only when the app starts, so the off switch has to be in the build-time settings. A new `e2e` build and serve configuration replaces the settings file with settings.e2e.ts, which is the Workplace settings with sentry_dsn ''. The Playwright webServer serves that configuration. Production, mobile, staging and plain `nx serve workplace` are unchanged and keep Sentry on. The harness guards are left as they are: they still catch any other request that leaves the stack. --- apps/workplace/playwright.config.ts | 5 +++-- apps/workplace/project.json | 11 +++++++++++ apps/workplace/src/environments/settings.e2e.ts | 10 ++++++++++ e2e/README.md | 6 ++++-- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 apps/workplace/src/environments/settings.e2e.ts diff --git a/apps/workplace/playwright.config.ts b/apps/workplace/playwright.config.ts index 7f99ddf9f2d..f97121c7804 100644 --- a/apps/workplace/playwright.config.ts +++ b/apps/workplace/playwright.config.ts @@ -115,8 +115,9 @@ export default defineConfig({ // No HMR: every compiled component otherwise imports // /@ng/component?c=…&t=… at load (96 of the 159 asset requests on each // browser-only meeting page), which those specs proxy through route.fetch, and - // the app never receives HMR updates here anyway. - command: `bunx nx serve workplace --port=${PORT} --hmr=false`, + // the app never receives HMR updates here anyway. The `e2e` + // configuration turns Sentry off (settings.e2e.ts). + command: `bunx nx serve workplace --configuration=e2e --port=${PORT} --hmr=false`, url: APP_URL, reuseExistingServer: !CI, cwd: workspaceRoot, diff --git a/apps/workplace/project.json b/apps/workplace/project.json index 63f4c50e8ef..824017cbae1 100644 --- a/apps/workplace/project.json +++ b/apps/workplace/project.json @@ -53,6 +53,14 @@ "browser": "apps/workplace/src/main.ts" }, "configurations": { + "e2e": { + "fileReplacements": [ + { + "replace": "libs/common/src/lib/settings.ts", + "with": "apps/workplace/src/environments/settings.e2e.ts" + } + ] + }, "staging": { "optimization": true, "fileReplacements": [ @@ -157,6 +165,9 @@ "buildTarget": "workplace:build" }, "configurations": { + "e2e": { + "buildTarget": "workplace:build:e2e" + }, "production": { "buildTarget": "workplace:build:production" } diff --git a/apps/workplace/src/environments/settings.e2e.ts b/apps/workplace/src/environments/settings.e2e.ts new file mode 100644 index 00000000000..0c95586b567 --- /dev/null +++ b/apps/workplace/src/environments/settings.e2e.ts @@ -0,0 +1,10 @@ +import { DEFAULT_SETTINGS as WORKPLACE_SETTINGS } from './settings'; + +/** + * Workplace build-time settings for the `e2e` build configuration, which + * Playwright serves. Sentry is off, so the app sends nothing to Sentry. + */ +export const DEFAULT_SETTINGS: any = { + ...WORKPLACE_SETTINGS, + app: { ...WORKPLACE_SETTINGS.app, sentry_dsn: '' }, +}; diff --git a/e2e/README.md b/e2e/README.md index 116bee894fc..fb26df72548 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -37,8 +37,10 @@ bunx playwright test --config apps/workplace/playwright.config.ts --ui `local` and `settings` depend on `preflight`, which checks the stack is up. Add `--no-deps` to skip it. -Playwright starts the Angular dev server itself (`nx serve workplace --port=4214`) -and points its API proxy at the stack. Nothing reaches the network. +Playwright starts the Angular dev server itself +(`nx serve workplace --configuration=e2e --port=4214`) and points its API proxy +at the stack. The `e2e` configuration turns Sentry off, so nothing reaches the +network. If a run dies with "Executable doesn't exist", the workspace's pinned Playwright needs its browser: `bunx playwright install chromium`.