From c096f4e8c9bb8ee26d77fb63e3362234763c2795 Mon Sep 17 00:00:00 2001 From: Bill Leoutsakos Date: Tue, 21 Jul 2026 15:13:53 -0700 Subject: [PATCH 1/8] Harden Playwright lifecycle and persona fidelity Close production-state and cleanup gaps so the settings E2E platform fails closed without sacrificing useful diagnostics. --- .github/workflows/test-build.yml | 2 +- apps/sim/app/(landing)/layout.tsx | 3 +- apps/sim/app/api/users/me/settings/route.ts | 1 + apps/sim/app/layout.tsx | 7 +- apps/sim/e2e/README.md | 25 +- apps/sim/e2e/fixtures/browser-test.ts | 22 + apps/sim/e2e/fixtures/factories/billing.ts | 2 + apps/sim/e2e/fixtures/persona-test.ts | 22 +- apps/sim/e2e/fixtures/validate-scenario.ts | 31 +- .../sim/e2e/foundation/build-manifest.spec.ts | 62 + .../foundation/scenario-validation.spec.ts | 15 +- apps/sim/e2e/scripts/capture-auth-states.ts | 19 +- apps/sim/e2e/scripts/run.ts | 102 +- apps/sim/e2e/scripts/seed-world.ts | 41 + apps/sim/e2e/settings/personas.ts | 10 +- .../e2e/settings/smoke/authenticated.spec.ts | 24 +- .../settings/smoke/unauthenticated.spec.ts | 2 +- apps/sim/e2e/support/browser-network.ts | 50 + apps/sim/e2e/support/build-manifest.ts | 10 +- apps/sim/e2e/support/process.ts | 22 +- apps/sim/e2e/support/run-lock.ts | 83 +- apps/sim/e2e/support/runtime-secrets.ts | 2 + apps/sim/e2e/support/sandbox-bundles.ts | 13 + apps/sim/e2e/support/stack.ts | 25 +- .../lib/billing/stripe-client-config.test.ts | 5 + apps/sim/lib/billing/stripe-client-config.ts | 16 + .../lib/execution/sandbox/bundles/docx.cjs | 26 +- .../execution/sandbox/bundles/integrity.json | 4 +- .../execution/sandbox/bundles/pptxgenjs.cjs | 34 +- .../0264_settings_super_user_default.sql | 1 + .../db/migrations/meta/0264_snapshot.json | 17365 ++++++++++++++++ packages/db/migrations/meta/_journal.json | 7 + packages/db/schema.ts | 2 +- 33 files changed, 17941 insertions(+), 114 deletions(-) create mode 100644 apps/sim/e2e/fixtures/browser-test.ts create mode 100644 apps/sim/e2e/support/browser-network.ts create mode 100644 packages/db/migrations/0264_settings_super_user_default.sql create mode 100644 packages/db/migrations/meta/0264_snapshot.json diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 579c4fc0d48..e0a56adc266 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -319,7 +319,7 @@ jobs: run: bun run test:e2e - name: Upload E2E diagnostics - if: failure() + if: failure() && hashFiles('apps/sim/e2e/.runs/**/markers/leak-scan-complete.json') != '' uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: settings-e2e-${{ github.run_id }} diff --git a/apps/sim/app/(landing)/layout.tsx b/apps/sim/app/(landing)/layout.tsx index 9fef6524507..f9c31e12780 100644 --- a/apps/sim/app/(landing)/layout.tsx +++ b/apps/sim/app/(landing)/layout.tsx @@ -11,6 +11,7 @@ import { XPageViewTracker } from '@/app/(landing)/x-page-view-tracker' const HUBSPOT_SCRIPT_SRC = 'https://js-na2.hs-scripts.com/246720681.js' as const const X_PIXEL_ID = 'q5xbl' as const +const isMarketingAnalyticsEnabled = isHosted && !process.env.E2E_PROFILE /** X (Twitter) conversion tracking base code — loads uwt.js and fires the initial PageView. */ const X_PIXEL_BASE_CODE = `!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments); @@ -43,7 +44,7 @@ export default function LandingLayout({ children }: { children: ReactNode }) { {children} {/* HubSpot + X pixel tracking — hosted only */} - {isHosted && ( + {isMarketingAnalyticsEnabled && ( <>