feat(desktop): add standalone Playwright screenshot helper#795
Merged
Conversation
The desktop app requires the E2E mock bridge (`window.__SPROUT_E2E__`) injected via `addInitScript` before page scripts run. This makes the Playwright MCP browser unusable for ad-hoc testing since it can only evaluate JS after page load. Standalone scripts using the Playwright API can use `addInitScript`, so this helper wraps the mock bridge setup from `bridge.ts` into a CLI-driven screenshot tool. Accepts --name, --route, --click, --wait, --viewport, and --outdir flags. Bare --click values auto-expand to data-testid selectors.
Future agent sessions need to know about the screenshot helper and why the Playwright MCP browser can't drive the desktop app directly.
wesbillman
approved these changes
May 29, 2026
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.
Adds
desktop/tests/helpers/screenshot.mjs, a CLI-driven headless Chromium script for capturing screenshots of the desktop app UI with the E2E mock bridge pre-injected.The desktop app requires
window.__SPROUT_E2E__to be injected before any page scripts run (viaaddInitScript) to mock the Tauri IPC layer. The Playwright MCP browser can only evaluate JS after page load, so it can't drive the app directly. This script wraps the same mock bridge setup frombridge.tsinto a standalone tool that agents and developers can invoke without writing boilerplate each time.installMockBridgesetup: workspace seeding, onboarding flags,__SPROUT_E2E__config, andMockNotificationmock--name,--route,--click,--wait,--viewport, and--outdirflags--clickaccepts baredata-testidvalues (e.g.open-search) or full CSS selectorstest-results/screenshots/(already gitignored) and prints the path to stdoutAGENTS.mdso future agent sessions can discover and use it