Commit Graph

2 Commits

Author SHA1 Message Date
ethernet d408e6b6c3 refactor(e2e): extract shared mock inference server
The OpenAI-compatible mock server used by the desktop E2E suite
(apps/desktop/e2e/mock-server.ts) was hand-duplicated into
apps/desktop/scripts/dev-mock.mjs for local dev, which had already
drifted (dev-mock.mjs lacked scripted tool-call turns and had its own
copy of the SSE framing).

Extract the dependency-free core (models list, chat completions,
streaming/non-streaming, canned reply, prompt capture) into
scripts/mock-inference-server.mjs, runnable standalone via Node
(no npm install needed — only node:http/fs) or importable as a module.
It exposes an onCompletionRequest hook so callers can layer scripted
multi-turn tool-call sequences on top without forking the core.

apps/desktop/e2e/mock-server.ts now wraps the shared module, keeping
only the desktop-specific scripted turns (interim messages, sidebar
states, queue-stop, correction-switch, verification-stop, blocking
clarify) and all existing exports. apps/desktop/scripts/dev-mock.mjs
now imports the shared module directly instead of carrying its own
copy.

This makes the mock server reusable outside apps/desktop, e.g. from
tests/install/install-update-e2e.sh for a real CLI chat round-trip.
2026-08-05 00:49:56 -04:00
ethernet 0860ee4e5a feat(desktop/e2e): Playwright E2E suite with visual regression diffs
Adds a full desktop Playwright E2E suite that launches the Electron app
against a mock inference server, exercising the full boot chain:

  electron -> hermes serve -> mock provider -> renderer

Includes:
- Mock OpenAI-compatible inference server (mock-server.ts)
- Shared fixtures with sandbox isolation (credentials, HERMES_HOME,
  userData, fixed window-state.json for reproducible screenshots)
- Test specs: boot, boot-failure, onboarding, mock-backend-setup, chat,
  and packaged-app launch
- Visual regression: expectVisualSnapshot() wraps toHaveScreenshot in
  try/catch so diffs are reported without failing the test suite
- CI workflow: xvfb at 1280x1024, baseline cache from main
  (--update-snapshots on main, compare on PRs), step summary table with
  diff/actual/expected image links, dedicated visual-diffs artifact
- dev:mock script for local fake-provider development
- test:e2e:visual + test:e2e:update-snapshots scripts using cage
- .gitignore: *-snapshots/ (baselines cached in CI, not committed)
2026-07-20 11:44:40 -04:00