Skip to content

test: Playwright e2e suite — flow smoke + multi-viewport layout assertions - #11

Merged
danielglh merged 1 commit into
mainfrom
test/e2e-playwright-suite
Aug 29, 2026
Merged

test: Playwright e2e suite — flow smoke + multi-viewport layout assertions#11
danielglh merged 1 commit into
mainfrom
test/e2e-playwright-suite

Conversation

@danielglh

Copy link
Copy Markdown
Owner

What

Adds an e2e/ workspace (bun run test:e2e) running Playwright against the real server in mock mode — built app, token auth, fresh data dir per run — plus a CI job gating it. This is the roadmap item that used to live in the README, scoped small.

Flow smoke (tests/flows.spec.ts):

  • token gate refuses a wrong token, unlocks with the right one
  • new-session dialog → mock tool approval lands as a dialog → approve → a full turn streams (user echo, thinking block, tool card) → composer returns to idle
  • assistant opens from the rail (reset control + composer present)
  • logout revokes server-side (stays gated across reload)

Multi-viewport layout (tests/layout.spec.ts), at 320 / 390 / 768 / 1280 / 1440:

  • exactly one visible copy of the global header actions (theme/settings/logout) — catches the duplicated-mobile-header class of bug
  • no horizontal document overflow — a generic invariant that catches clipping bugs without screenshot diffs
  • the composer's primary button stays contained in the composer box (bounding-box assertion, not DOM presence — a poking-out button still 'exists' and 'is clickable'), idle, queued, and after draining

It already paid for itself

Day one, the suite caught two more real bugs, fixed in the same PR:

  1. streamCannedTurn stamped the assistant message with Date.now() in the same millisecond as the user echo (its first step runs synchronously), and the client upserts live messages by timestamp alone — so the assistant's message_start swallowed the user echo and the bubble silently never rendered. Live messages are now identified by (role, timestamp) — the same identity sameMessage already uses for history dedupe — and the mock stamps strictly-increasing timestamps.
  2. (Complements fix: mobile session header duplication, composer overflow, stuck mock state #10's streamTimer fix; both found by the new idle-state assertion.)

Notes

  • bun run check and both unit suites still pass; e2e is a separate script + CI job (browser install is too heavy for the check-and-test job).
  • CI installs chromium via bunx playwright install --with-deps chromium; failures upload the Playwright report as an artifact.

…tions

Adds an e2e/ workspace running Playwright against the real server in mock
mode (built app, token auth, fresh data dir per run): bun run test:e2e,
gated as a CI job.

Flows (tests/flows.spec.ts): token gate refuses a wrong token and unlocks
with the right one; new-session dialog → approve the tool call → a full
turn (user echo, thinking block, tool card) drains back to an idle
composer; assistant opens from the rail; logout revokes server-side.

Layout (tests/layout.spec.ts) at 320/390/768/1280/1440: exactly one
visible copy of the global header actions (catches the duplicated mobile
header class of bug), no horizontal document overflow, and the composer's
primary button contained within the composer box — idle, queued, and
after draining. DOM-presence tests alone would pass a poking-out button,
so containment is asserted via bounding boxes.

The suite immediately caught two more mock bugs, fixed here:
- streamCannedTurn stamped the assistant message with Date.now() in the
  same millisecond as the user echo, and the client upserts live messages
  by timestamp alone — so the assistant start swallowed the user echo and
  the bubble never rendered. Live messages are now identified by
  (role, timestamp), matching sameMessage(), and the mock stamps
  strictly-increasing timestamps.
@danielglh
danielglh merged commit 465ce27 into main Aug 29, 2026
2 checks passed
@danielglh
danielglh deleted the test/e2e-playwright-suite branch August 29, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant