Desktop E2E Fixture Seeding
Use this skill to turn a live desktop session into replay-backed Electron test
coverage.
Read First
Repo and desktop AGENTS.md instructions already apply. For this workflow,
read these files first:
Then read the scenario recipe you are seeding or refreshing:
- ../../../apps/desktop/e2e/fixtures/approval-pending/capture-recipe.md
- ../../../apps/desktop/e2e/fixtures/turn-lifecycle/capture-recipe.md
- ../../../apps/desktop/e2e/fixtures/edited-changes-order/capture-recipe.md
If you are adding a new scenario, mirror those recipe files and update the
shared fixture workflow doc.
Workflow
- Pick the scenario and confirm whether you are refreshing an existing fixture
or adding a new one.
- Prepare a disposable worktree if the capture recipe edits files.
- Launch the desktop app in record mode:
```bash
PWRAGNT_PROTOCOL_CAPTURE=true \
PWRAGNT_PROTOCOL_CAPTURE_ROOT=/tmp/pwragent-protocol-captures \
pnpm dev
```
- Use Computer Use primitives only and follow the scenario recipe exactly:
get_app_stateclicktype_textpress_keyscroll
- Stop at the recipe's documented stop point. Record the backend-qualified
session id, thread id, and capture id if the export flow exposes them.
- Export the raw session evidence:
```bash
pnpm --filter @pwragent/desktop export:session-capture -- \
--capture-root /tmp/pwragent-protocol-captures \
--session codex:<thread-id> \
--output /tmp/<scenario>.raw.capture.jsonl
```
- Derive the curated replay fixture:
```bash
pnpm --filter @pwragent/desktop derive:replay-fixture -- \
--input /tmp/<scenario>.raw.capture.jsonl \
--output-dir apps/desktop/e2e/fixtures/<scenario> \
--scenario <scenario> \
--backend codex \
--thread-id <thread-id> \
--source-capture-id <capture-id> \
--start <sequence> \
--end <sequence>
```
- Add or update the Playwright Electron spec. Follow the style in:
- Run the relevant checks:
```bash
pnpm test:desktop-e2e
pnpm test
pnpm typecheck
```
Guardrails
- Do not hand-edit
raw.capture.jsonl. - Keep the replay window tight. Preserve only the protocol slice needed for the
user-visible assertion.
- Keep
capture-recipe.md,raw.capture.jsonl, andreplay.fixture.json
together in the same scenario directory.
- Prefer assertions on visible UI outcomes, transcript order, and composer
state rather than protocol internals.
- Update ../../../README.md and
../../../apps/desktop/e2e/fixtures/README.md
when you add a new scenario or materially change the operator workflow.