Skip to content

Commit 2366ffc

Browse files
committed
refactor(aidd-dev): streamline browser QA setup
Keep dependency recovery explicit while preserving deterministic Playwright and video evidence.
1 parent 43f14f9 commit 2366ffc

5 files changed

Lines changed: 68 additions & 28 deletions

File tree

plugins/aidd-dev/CATALOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ Auto-generated index of skills, agents, references and assets shipped by the `ai
161161

162162
| Group | File | Description |
163163
|-------|------|---|
164+
| `actions` | [00-prerequisites.md](skills/11-browser-qa/actions/00-prerequisites.md) | - |
164165
| `actions` | [01-load-scope.md](skills/11-browser-qa/actions/01-load-scope.md) | - |
165166
| `actions` | [02-prepare-run.md](skills/11-browser-qa/actions/02-prepare-run.md) | - |
166167
| `actions` | [03-run-scenarios.md](skills/11-browser-qa/actions/03-run-scenarios.md) | - |

plugins/aidd-dev/skills/11-browser-qa/SKILL.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
name: 11-browser-qa
33
description: Run post-review browser QA and produce short named videos for a locked happy path and sourced browser edge cases. Use when the user wants concise reviewer evidence for a web journey. Not for API, CLI, automated tests, diff review, or application fixes.
4-
argument-hint: load-scope | prepare-run | run-scenarios
4+
argument-hint: prerequisites | load-scope | prepare-run | run-scenarios
55
---
66

77
# Browser QA
88

99
```mermaid
1010
flowchart LR
11-
scope["load-scope"] --> prepare["prepare-run"] --> run["run-scenarios"]
11+
prerequisites["prerequisites"] --> scope["load-scope"] --> prepare["prepare-run"] --> run["run-scenarios"]
1212
```
1313

1414
## Actions
@@ -17,6 +17,7 @@ Read only the next action's file before running it.
1717

1818
| # | Action | Does |
1919
| --- | --------------- | ---------------------------------------------------------- |
20+
| 00 | `prerequisites` | Verify the browser runner and media dependencies |
2021
| 01 | `load-scope` | Lock one happy path and a bounded set of sourced edge cases |
2122
| 02 | `prepare-run` | Resolve the shortest deterministic path to executable runs |
2223
| 03 | `run-scenarios` | Record, normalize, verify, reset, and report every scenario |
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# 00 - Prerequisites
2+
3+
Verify the runner dependencies before resolving the QA scope.
4+
5+
## Input
6+
7+
None.
8+
9+
## Output
10+
11+
Verified `npx`, Playwright CLI `0.1.17`, `ffmpeg`, and `ffprobe`.
12+
13+
## Process
14+
15+
1. **Check.** In one pass, resolve `npx`, run `npx --yes @playwright/cli@0.1.17 --version`, and resolve `ffmpeg` and `ffprobe`.
16+
2. **Continue.** When every check passes, continue without reporting it.
17+
3. **Resolve.** When a dependency is missing, ask one concise question: the user installs the listed dependencies, or authorizes you to install them now.
18+
1. If the user installs them, provide only the shortest platform-appropriate commands and stop until they confirm completion.
19+
2. If authorized, install only the missing dependencies, then rerun every check.
20+
4. **Stop.** Report the shortest decisive error when installation is declined or a recheck fails.
21+
5. **Protect.** Never add runner or media dependencies to the application manifest.
22+
23+
## Test
24+
25+
- Passing checks produce no message.
26+
- A missing dependency produces one choice and no unapproved installation.
27+
- Either installation path reruns every check before continuing.
28+
- No application dependency file changes.

plugins/aidd-dev/skills/11-browser-qa/actions/02-prepare-run.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# 02 - Prepare Run
22

3-
Resolve every operational dependency before retained recording begins.
3+
Resolve the application state and scenario paths before retained recording begins.
44

55
## Input
66

7-
Earlier defined scope.
7+
Verified prerequisites and the earlier defined scope.
88

99
## Output
1010

11-
A successfull prepared run with a reachable application, authenticated sessions, deterministic fixtures, executable scenario steps, proven teardown, and available recording and media tools.
11+
A successful prepared run with a reachable application, authenticated sessions, deterministic fixtures, executable scenario steps, and proven teardown.
1212

1313
## Process
1414

15-
1. **Preflight.** Batch the independent checks for the application, pinned Playwright CLI, `ffprobe`, `ffmpeg`, and the fixed `1280×720` viewport.
15+
1. **Preflight.** Check the application and fixed `1280×720` viewport.
1616
2. **Reuse.** Read `aidd_docs/memory/testing.md` first when it exists.
1717
1. Resolve Browser QA entry, auth, fixtures, and reset from its `Browser QA` section, then a directly related browser test, then one targeted browser snapshot.
1818
2. Stop searching as soon as the run is executable.
Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
# Playwright CLI runner
22

3-
Run browser QA through the Playwright Agent CLI. It produces human-viewable WebM recordings without adding a test dependency to the application.
3+
Playwright Agent CLI produces WebM evidence without becoming an application dependency.
44

5-
## Invocation
5+
## Version and invocation
66

7-
Use the framework pin below. The current version is `0.1.17`.
7+
Support `@playwright/cli >= 0.1.17`; execute the framework pin `@playwright/cli@0.1.17`. Upgrade it deliberately, never through `latest` during QA.
88

99
```bash
1010
npx --yes @playwright/cli@0.1.17 -s=qa-<run-id> <command>
1111
```
1212

13-
Upgrade the pin deliberately with the framework, never by using `latest` during a QA run.
13+
`run-code` takes one `page` argument: pass `async page => { ... }`, never bare statements. Keep stdout, stderr, and exit status visible; no redirects, pipes, command substitutions, or `|| true`. A `SyntaxError` or non-zero exit invalidates the take.
1414

15-
`run-code` receives one `page` argument. Pass a complete function with the exact shape `async page => { ... }`, never bare statements. Keep its stdout, stderr, and exit status visible: never redirect, pipe, use command substitution, append `|| true`, or otherwise mask them. A `SyntaxError` or non-zero exit invalidates the take.
15+
## Recording
1616

17-
## Recording contract
18-
19-
Use one named session and one raw WebM per scenario. Fix the browser viewport and recording frame at `1280×720`. Reach the prepared initial state before `video-start`. Drive every recorded interaction in one `run-code`; never issue recorded click, fill, or scroll commands separately. Hold the initial state for `1000 ms`. Wait `300 ms` between scenario actions and after every scroll. Verify the observable result, hold it for `1000 ms`, then stop. Run `video-stop` only after `run-code` exits successfully.
17+
- One named session and raw WebM per scenario; viewport and frame `1280×720`.
18+
- Reach the initial state before `video-start`; put every recorded interaction in one `run-code`.
19+
- Never record separate click, fill, or scroll commands.
20+
- Hold the initial and verified final states for `1000 ms`.
21+
- Wait `300 ms` between actions and after each scroll.
22+
- Run `video-stop` only after `run-code` succeeds.
2023

2124
```bash
2225
npx --yes @playwright/cli@0.1.17 -s=qa-<run-id>-<scenario-slug> resize 1280 720
2326
npx --yes @playwright/cli@0.1.17 -s=qa-<run-id>-<scenario-slug> video-start raw-<evidence-name>.webm --size=1280x720
24-
# Replace the example locators and omit the scroll block when irrelevant.
27+
# Replace the locators; omit the scroll block when irrelevant.
2528
npx --yes @playwright/cli@0.1.17 -s=qa-<run-id>-<scenario-slug> run-code 'async page => {
2629
const pause = milliseconds => page.waitForTimeout(milliseconds);
2730
await pause(1000);
28-
2931
await page.getByRole("button", { name: "first action" }).click();
3032
await pause(300);
31-
3233
await page.mouse.wheel(0, 600);
3334
await pause(300);
34-
3535
await page.getByRole("button", { name: "final action" }).click();
3636
await page.getByText("observable expected outcome").waitFor({ state: "visible" });
3737
await pause(1000);
@@ -40,21 +40,21 @@ npx --yes @playwright/cli@0.1.17 -s=qa-<run-id>-<scenario-slug> video-stop
4040
npx --yes @playwright/cli@0.1.17 -s=qa-<run-id>-<scenario-slug> close
4141
```
4242

43-
`video-stop` writes under `.playwright-cli/` in the current directory. Use `raw-happy-path.webm` and `raw-edge-case-<scenario-slug>.webm`.
43+
`video-stop` writes to `.playwright-cli/` in the current directory. Name raw files `raw-happy-path.webm` or `raw-edge-case-<scenario-slug>.webm`.
4444

45-
## Duration gate
45+
## Duration
4646

47-
Inspect every raw take in one call.
47+
Probe each raw take once. Maximum 12 seconds, never a target; do not pad or extend.
4848

4949
```bash
5050
ffprobe -v error -select_streams v:0 \
5151
-show_entries stream=codec_name,width,height:format=duration \
52-
-of json raw-<evidence-name>.webm
52+
-of json <input.webm>
5353
```
5454

55-
Twelve seconds is a maximum, never a target. Never pad or extend a shorter take. When `ffmpeg` is unavailable, only an already-short raw take can pass. A take above 12 seconds reports `blocked: media-postprocess-unavailable`.
55+
Without `ffmpeg`, only an already-short raw take passes; otherwise report `blocked: media-postprocess-unavailable`.
5656

57-
Never infer the first action from a scene-change threshold and never trim the head: the initial one-second hold is required evidence. Before trimming tail time, extract and inspect frames immediately before and after the proposed cut. Reject a cut that removes the observable result or its final one-second hold.
57+
Never trim the head or infer the first action from scene changes. Inspect both sides of a tail cut; reject one that removes the result or final one-second hold.
5858

5959
```bash
6060
qa_cut_frames=$(mktemp -d)
@@ -64,22 +64,32 @@ ffmpeg -v error -ss <cut-plus-0.25-seconds> -i raw-<evidence-name>.webm \
6464
-frames:v 1 "$qa_cut_frames/after.png"
6565
```
6666

67-
Re-encode without audio. Use only a visually verified tail cut; omit `-to` when none is needed.
67+
## Normalization
68+
69+
Re-encode without audio. Use only a visually verified tail cut; omit `-to` when unused.
6870

6971
```bash
7072
ffmpeg -y -to <verified-end-seconds> -i raw-<evidence-name>.webm \
7173
-an -vf "fps=12,scale=1280:-2:force_original_aspect_ratio=decrease" \
7274
-c:v libvpx-vp9 -crf 36 -b:v 0 <evidence-name>.webm
7375
```
7476

75-
When the meaningful take still exceeds 12 seconds, remove non-scenario actions and record it again. Never accelerate a take because that invalidates the pacing contract. Report blocked when the required journey cannot fit.
77+
Above 12 seconds, remove non-scenario actions and record again. Never accelerate. Block when the required journey cannot fit.
78+
79+
## Validation
7680

77-
Inspect the final file with the same `ffprobe` command, then extract frames at four frames per second and inspect them in chronological order. Require the initial state, every scenario action, every transition, and the final observable result to be visible. The initial and final holds must each span at least four sampled frames. `ffprobe` alone never validates a take.
81+
Probe the final file, then inspect four frames per second chronologically.
7882

7983
```bash
8084
qa_final_frames=$(mktemp -d)
8185
ffmpeg -v error -i <evidence-name>.webm -vf "fps=4" \
8286
"$qa_final_frames/frame-%03d.png"
8387
```
8488

85-
Require codec `vp9`, width `1280`, and duration at most 12 seconds. Remove raw takes, cut-point frames, and final validation frames only after every final WebM passes both gates.
89+
Require:
90+
91+
- codec `vp9`, width `1280`, duration at most 12 seconds;
92+
- initial state, every action and transition, and final result visible;
93+
- initial and final holds spanning at least four sampled frames.
94+
95+
`ffprobe` alone is insufficient. Delete raw takes, cut-point frames, and validation frames only after every final WebM passes both checks.

0 commit comments

Comments
 (0)