test(e2e): cover the terminal WS contract with a real shell connect - #220
Open
thinkbig1979 wants to merge 2 commits into
Open
test(e2e): cover the terminal WS contract with a real shell connect#220thinkbig1979 wants to merge 2 commits into
thinkbig1979 wants to merge 2 commits into
Conversation
The terminal was silently broken in production for three weeks (frontend dials the WS route with the container ID, the membership check matched names only — fixed in #219) because both sides' unit tests passed against their own assumption and nothing ever crossed the contract with a real connect. terminal-flow.spec.ts is that connect: it starts the seeded test-app stack, opens a shell via both entry points (the Overview row's Shell action and the Terminal tab's container-ID-keyed dropdown), and proves the session is a live PTY by running a command and reading its computed output back out of xterm's DOM rows. One shared page across the serial block keeps the suite under the backend's 10-per-user WS cap. Picked up automatically by the backup-flow CI job (bare playwright invocation, grep-invert auth-session); no workflow change needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TERM-PW-003 flaked on its first CI run and intermittently locally (3 of 6 runs): a full-page goto() raced the stack query's one-shot fetch for the toolbar, and after switching to SPA tab navigation, a tab click could land in the same tick as a React re-render of the freshly-mounted Overview (metrics stream + stack refetch) and dispatch into a swapped node, leaving the route unchanged. Navigate via the tabs instead of goto(), and wrap each tab click in an expect().toPass() that re-clicks until the route actually changes. 6/6 consecutive local runs clean with zero Playwright retries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the coverage gap that let the terminal sit broken in production for three weeks (#219): the frontend dials
/ws/terminal/:id/:containerwith the container ID, the membership check matched names — each side's unit tests passed against its own assumption, and nothing ever crossed the contract with a real connect.What the spec does
terminal-flow.spec.ts, running in the existing backup-flow CI job (auto-discovered — barenpx playwright testwith--grep-invert auth-session, no workflow change):test-appstack via the lifecycle API and polls untilrunning(generous timeout for the first-run nginx image pull).Shell: test-app-web-1→ asserts the?container=<hex id>deep link and the connected state ("Disconnect terminal" renders only while connected) and the BusyBox/ #prompt in xterm's DOM rows.echo capstan-e2e-$((21+21))and assertscapstan-e2e-42appears — computed output proves a live duplex PTY, not keystroke echo.container.id— the exact path that was denied for three weeks) connects from a fresh navigation.One shared page across the serial block keeps the suite under the backend's 10-per-user WS connection cap (
AUTH_DISABLEDmakes every socket "anonymous", and dead sockets linger for the 60s read deadline).Verification
Recon done with agent-browser against a CI-identical local environment (vite :3001 proxying to backend :5001,
AUTH_DISABLED=true, seeded stoppedtest-app); all selectors in the spec are recon-verified. Suite run twice back-to-back locally: 3/3 passed both times (11.5s cold with stack start, 5.2s warm), confirming idempotence against an already-running stack.🤖 Generated with Claude Code