Repository navigation
feat(dashboard): SQLite run history, remove Quick Presets, run output reorder & expanded docs - #118
Conversation
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR migrates Playwright run history persistence from individual JSON files under ChangesRun History SQLite Persistence
Sequence DiagramsequenceDiagram
participant Dashboard
participant Server
participant SQLite
Dashboard->>Server: GET /api/playwright/history or /results/:runId
Server->>SQLite: SELECT raw_json, run_log FROM runs WHERE id=?
SQLite-->>Server: row(s)
Server-->>Dashboard: normalized results + run_log
Dashboard->>Server: POST to start run (SSE)
Server-->>Dashboard: SSE events (stdout, summary_*)
Dashboard->>Dashboard: runAbortRef aborts SSE controller on Stop
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
… above history - Replace JSON-file run storage with SQLite (better-sqlite3): archiveRun() now writes id/run_at/spec/counts/run_log/raw_json into a single runs.db; GET /history reads via prepared SELECT; GET /results/:id reads raw_json + run_log from DB; DELETE /history executes DELETE FROM runs — no more RUNS_DIR file scatter - Remove Quick Presets entirely: delete Preset interface, SV_CONFIG, SV_ALL_SPECS, PRESETS array, applyPreset(), noPresets prop, both JSX blocks (SettingsView card + always-visible presets bar), and unused Zap icon import - Move Run Output terminal above Run History (RunsPanel) so users see the latest stdout immediately after a run without scrolling past the history table Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tent - Quick Start: add playwright.config.ts essentials block (multi-project, reporters, trace/screenshot/video defaults) - Locator Strategies: add getByTitle(), expand code examples with chaining, correct all descriptions - Core Assertions: expand from 11 to 20 assertions across 4 card groups (toBeAttached, toBeDisabled, toBeEditable, toHaveValues, toHaveClass, toHaveCSS, toHaveCount, toHaveAccessibilityTree); add negation + soft-assertion examples - Common Patterns: add Parallel & Sharded runs section; expand POM with typed Locator fields; update Fixtures with DashboardPage; add network modify-response pattern - Authentication (new section): global-setup storageState, multi-role auth, API-based JWT auth, config project setup - Visual & Accessibility Testing (new section): screenshot workflow steps, mask/maxDiffPixelRatio options, axe-core WCAG 2.1 AA integration, accessibility checklist (keyboard, contrast, alt text, RTL, ARIA) - CI / CD Integration (new section): GitHub Actions workflow, sharding across parallel jobs, environment variables, recommended CI flags - CLI Reference: expand from 11 to 16 flags (--grep-invert, --forbid-only, --shard, --update-snapshots, --pass-with-no-tests); add merge-reports and --help examples - Add GitBranch icon import; add 3 new TOC entries and sidebar links Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… cache
- Remove RUN_HISTORY_KEY and the lazy localStorage initialiser for
runHistory — state now always starts as [] and is populated by the
first fetchHistory() call on mount
- Remove the useEffect that wrote runHistory back to localStorage after
every change (stale cache was masking real DB data on page refresh)
- Add one-time localStorage.removeItem('pw_run_history_v1') at module
level to clear any stale pre-SQLite data in existing browsers
- Remove LIMIT 30 cap from GET /api/playwright/history — all runs are
returned from SQLite; caller can pass ?limit=N to override
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Stop button was calling setRunning(false) directly, which only
updated local state. The AbortController inside runWithSSE/runDynamicTest
was never invoked, so:
1. The fetch/SSE stream kept running server-side after Stop was clicked
2. When the orphaned stream eventually finished, its finally block
called setRunning(false) again — silently cancelling any new run
the user had just started
Fix: store the AbortController in runAbortRef (useRef). The Stop button
now calls runAbortRef.current?.abort() which throws an AbortError inside
the running fetch, causing the catch block to log [TIMEOUT] and the
finally block to clean up normally. Both runWithSSE and runDynamicTest
are updated; the ref is cleared in each finally block.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… SQLite streamSummary() still used path.join(RUNS_DIR, ...) to load the archived run JSON for the AI post-mortem, but RUNS_DIR was deleted in the SQLite migration. This crashed the server the moment a run finished, keeping the dashboard stuck in RUNNING state forever. Fix: when creds.runId is set, query the runs table directly (SELECT raw_json FROM runs WHERE id = ?); fall back to RESULTS_PATH only when no runId is provided (legacy path). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c035c3f to
c1d228e
Compare
…& run output reorder Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
test-results/runs/with a singlebetter-sqlite3database (test-results/runs.db).archiveRun()INSERTs into the DB;/api/playwright/history,/api/playwright/results/:runId, andDELETE /api/playwright/historyall query SQLite directly.PRESETSconstant,applyPreset(),noPresetsprop, and the entire preset card from the Settings panel.runAbortRefuseRef pattern ensures the Stop button aborts the active SSE fetch without racing against subsequent runs.localStoragecaching of run history to prevent stale pre-migration data surfacing on page load.streamSummarycrash fix — removed staleRUNS_DIRreference left over from JSON-file era; readsraw_jsonfrom SQLite whenrunIdis present.Test plan
npm install—better-sqlite3installs cleanly on Node 20npm run dev— server starts;test-results/runs.dbis created automatically/api/playwright/historyafter completionnpx tsc --noEmitandcd ui && npx tsc --noEmit— zero type errorsnpm run format:check— passesSummary by CodeRabbit
New Features
Changed
Bug Fixes
Chores