Skip to content

feat: add Playwright E2E tests for Fast and Agent search#5

Merged
doodlewind merged 1 commit intomainfrom
feat/e2e-tests
Mar 27, 2026
Merged

feat: add Playwright E2E tests for Fast and Agent search#5
doodlewind merged 1 commit intomainfrom
feat/e2e-tests

Conversation

@graydawnc
Copy link
Copy Markdown
Collaborator

@graydawnc graydawnc commented Mar 27, 2026

What

Playwright E2E tests that verify both search modes end-to-end: fixture JSONL → sync → SQLite FTS → UI rendering (Fast mode), and ACP mock agent → JSON-RPC streaming → answer card rendering (Agent mode).

Why

Zero automated tests existed. Manual testing can't catch regressions in the sync→index→search→render pipeline or the ACP streaming protocol. These tests run the real Electron app against fixture data and mock agents, catching integration bugs that unit tests would miss.

Changes

Test infrastructure

  • e2e/helpers/launch.ts — shared Electron launcher with temp dir isolation, waitForSync/search helpers
  • e2e/mocks/acp-base.mjs — shared ACP JSON-RPC 2.0 transport (NDJSON/stdio)
  • e2e/mocks/acp-mock-agent.mjs — success mock: streams text chunks + tool call
  • e2e/mocks/acp-mock-agent-error.mjs — error mock: returns JSON-RPC error on prompt
  • e2e/fixtures/ — two JSONL sessions with canary keywords for deterministic search

Core: env var overrides for test isolation

  • SPOOL_DATA_DIR — override DB location (db.ts)
  • SPOOL_CLAUDE_DIR / SPOOL_CODEX_DIR — override sync directories (syncer.ts, watcher.ts)
  • SPOOL_ACP_AGENT_BIN — override ACP extension resolution (acp.ts)

UI: data-testid attributes

search-input, mode-agent, fragment-row, ai-answer-card, ai-answer-text, ai-error, status-text

CI

.github/workflows/e2e.yml — matrix on ubuntu-latest + macos-latest, xvfb-run on Linux, electron-rebuild for native modules

Test coverage (11 tests, ~4s)

Mode Test Verifies
Home title + session counts sync pipeline, UI render
Fast canary keyword search JSONL parse, SQLite FTS, results
Fast snippet highlighting FTS mark to strong rendering
Fast session metadata first-person phrasing + source badge
Fast cross-session search different canary in different session
Fast empty results No results state
Agent streaming + trust label + tool calls full ACP mock pipeline
Agent FTS sources Sources used section
Agent query preserved mode toggle keeps input
Agent second query replaces previous answer
Agent error error message + trust label error state rendering

Submitter: @graydawnc

@graydawnc graydawnc force-pushed the feat/e2e-tests branch 5 times, most recently from c4cc701 to 045996d Compare March 27, 2026 16:32
- Add fixture JSONL sessions with canary keywords for deterministic testing
- Add ACP mock agents (success + error) speaking JSON-RPC 2.0 over stdio
- Add SPOOL_DATA_DIR/SPOOL_CLAUDE_DIR/SPOOL_CODEX_DIR env var overrides
  in core so tests use isolated temp DB and fixture data
- Add SPOOL_ACP_AGENT_BIN env var to override ACP extension resolution
- Add data-testid attributes to SearchBar, FragmentResults, AiAnswerCard,
  StatusBar for reliable test selectors
- Add @playwright/test dependency and test:e2e script
- Add GitHub Actions workflow (macos-latest, no Xvfb needed)

Tests (11):
  Fast mode: home view, FTS search, snippet highlighting, metadata,
             cross-session search, empty results, mode toggle
  Agent mode: ACP streaming + trust label + tool calls + sources,
              second query replacement, error handling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@doodlewind doodlewind merged commit 6b2a352 into main Mar 27, 2026
2 checks passed
@doodlewind doodlewind deleted the feat/e2e-tests branch April 7, 2026 09:47
graydawnc added a commit that referenced this pull request Apr 28, 2026
One-time notice for users upgrading from a pre-M5 Spool, plus the
cross-cutting documentation cleanup that PR2-#5 deferred.

## Upgrade notice

Built as a React modal (not a native dialog) so it matches Spool's
design system — warm card, Geist Sans, accent CTA — and shows the
real Spool Daemon app icon (copied from spool-lab/spool-daemon).

Trigger logic (in main, exposed via IPC):
- shouldShow = !shown && !wasNewDb && initialUserVersion < 5
- New users with no prior DB → don't show (no captures to mourn)
- Existing users at v0-v4 → show on first launch after upgrade
- After dismiss/install click → flag persists, never shown again
- User who quits without dismissing → loses the notice (acceptable
  for an informational nudge; not critical state)

The "wasNewDb" + "getInitialUserVersion" helpers are added to
packages/core/src/db/db.ts. Both are captured before runMigrations
runs so the post-state can't muddy the upgrade detection.

uiPreferences now respects SPOOL_DATA_DIR (was hardcoded to
~/.spool/ui.json regardless of env override) — this surfaced during
sandbox smoke testing and would have leaked dialog-shown state out
of test sandboxes.

The "Get Spool Daemon" button uses shell.openExternal to
https://spool.pro/daemon (was earlier mistakenly written as
spool.dev/daemon in three places — fixed across the dialog, README,
and positioning doc).

## Doc cleanup (cross-cutting)

- README.md — drop stars/bookmarks/likes from tagline, drop the
  Connectors bullet, replace with a forward to Spool Daemon, drop
  the fieldtheory-cli acknowledgement (Twitter bookmarks gone)
- DESIGN.md — drop bookmarks/capture from Product Context, rewrite
  Source Chips + Sources Panel sections to be session-only, drop
  "Capture / add" icon, fix Status Bar dot color guidance
- docs/spool-positioning.md — strip bookmark/star marketing, end
  with a forward to Spool Daemon
- packages/core/README.md — drop "connected sources", "connector
  sync engine", "connector loader", "connector registry" — replaced
  with watcher + stars
- Deleted docs/connector-developer-guide.md (607 lines) and
  docs/connector-sync-architecture.md (924 lines) — both
  exclusively about the removed subsystem

docs/superpowers/* historical plans + specs left intact (they're
dated git-log-style records, not current docs).

## Tests

- Extended migration-v5.test.ts with assertions for the new
  wasNewDb / getInitialUserVersion helpers on both the upgrade
  path (wasNewDb=false, initialVersion=4) and the fresh-install
  path (wasNewDb=true, initialVersion=0).
- Smoke verified locally: launching dev against a downgraded v4
  sandbox shows the modal with the right icon and copy; clicking
  either button persists the flag and the modal does not return on
  re-launch.

Net -1466 / +103.

Co-authored-by: Chen <99816898+donteatfriedrice@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants