feat(playwright-1): add reusable Playwright E2E foundation#5792
Conversation
Establish a hermetic full-stack browser harness so settings and future surfaces can exercise real authentication, APIs, and isolated database state safely.
Fail closed on stale processes, preserve cleanup during interruption, and keep credentials and personal fixture data out of uploaded diagnostics.
Make destructive database operations and service bindings strictly local while ensuring interrupted runs fully stop managed children before cleanup.
Close the remaining lifecycle, credential-isolation, and CLI escape hatches so future persona and settings suites can build on a fail-closed foundation.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds a reusable full-stack Playwright E2E foundation. The main changes are:
Confidence Score: 4/5Interrupted runs can leave descendant processes or a run database behind.
apps/sim/e2e/support/process.ts and apps/sim/e2e/scripts/run.ts Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant O as E2E Orchestrator
participant DB as Run Database
participant SF as Stripe Fake
participant RT as Realtime
participant APP as Next.js
participant PW as Playwright
O->>DB: "Create and migrate sim_e2e_* database"
O->>SF: Start loopback fake
O->>RT: Start and verify run ID
O->>APP: Build, start, and verify run ID
O->>PW: Run guarded projects
PW->>APP: Exercise auth and settings flows
APP->>SF: Send guarded Stripe requests
O->>RT: Stop process
O->>APP: Stop process
O->>SF: Stop and save request log
O->>DB: Force-drop run database
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant O as E2E Orchestrator
participant DB as Run Database
participant SF as Stripe Fake
participant RT as Realtime
participant APP as Next.js
participant PW as Playwright
O->>DB: "Create and migrate sim_e2e_* database"
O->>SF: Start loopback fake
O->>RT: Start and verify run ID
O->>APP: Build, start, and verify run ID
O->>PW: Run guarded projects
PW->>APP: Exercise auth and settings flows
APP->>SF: Send guarded Stripe requests
O->>RT: Stop process
O->>APP: Stop process
O->>SF: Stop and save request log
O->>DB: Force-drop run database
|
| process.once('SIGINT', handleSignal) | ||
| process.once('SIGTERM', handleSignal) |
There was a problem hiding this comment.
A second SIGINT or SIGTERM during the synchronous database and process cleanup uses the OS default action and can terminate both the orchestrator and its foreground cleanup subprocess. A double Ctrl-C or CI termination escalation during the five-second database retry can therefore leave the run-scoped database or child processes behind.
Use a detached cleanup supervisor so repeated signals cannot interrupt process-group shutdown or forced removal of the guarded run database.
Prevent empty process-group targets and verify forced-drop retries against final database state so interrupted runs cannot self-signal or report false cleanup failures.
Reject dual-stack host mappings that cannot reach IPv4-only services and tolerate child exit races during process-group signal fallback.
Accept safe dual-stack loopback resolution while pinning Chromium and Node traffic to 127.0.0.1 so CI reaches IPv4-only services reliably.
Mark successful readiness before the managed process completion branch can reject, preventing later normal shutdown from surfacing an abandoned promise failure.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 47661af. Configure here.
Keep Node-based Playwright requests on the same IPv4 path as Chromium and use direct loopback for orchestrator probes under dual-stack CI DNS.
bdd0a48
into
e2e/settings-playwright

Summary
Production-facing deltas
/api/healthdynamic and include an E2E run identity only when configured, preventing readiness from accepting another local processREALTIME_HOSTwith the existing0.0.0.0default; E2E binds realtime to127.0.0.1Safety notes
.env*keys, use a run-scoped HOME, and disable ambient cloud credential discoverysim_e2e_*targetsDROP DATABASE ... WITH (FORCE), requiring PostgreSQL 13+; CI/local guidance pins pgvector/PostgreSQL 17Test plan
--repeat-each=2bun run type-checkinapps/simbun run type-checkinapps/realtimebun run lint:checkScope
This PR targets
e2e/settings-playwright, notstaging. It is Step 1 of the settings E2E roadmap; persona factories, authorization matrices, and full settings coverage follow in later focused PRs.Made with Cursor