review-ui-states
UI states
The deliverable is one page: every state of every flow as a screenshot, laid out as a graph per flow, with the reviewer's comments pinned on the screenshots. It exists so the reviewer can review an app without clicking through it, and so that their comments come back to you as a list you can fix in bulk. A second deliverable rides along: each flow's machine is a statement of which states exist, and writing it exposes where the code decides the screen from loose flags. Record those as findings.
A machine per flow, not a script per screenshot, is the point: @xstate/graph walks the shortest path to every state, so adding a state means adding a node and an event step, and the manifest the walk writes is what the canvas draws.
1. Set up the harness once per repo
Copy assets/harness/flow.ts, manifest.ts and capture.spec.ts into the repo's Playwright folder as ui-states/ (for example e2e/ui-states/); they are app-agnostic. assets/harness/canvas/ stays in the skill: the repo keeps the flows, the skill keeps the page that renders them. Add xstate and @xstate/graph as dev dependencies, and ignore ui-states/out/ and ui-states/.runs/ in git.
Write the two app-specific files. assets/example/ is a worked example from the Drive module of one Frappe app: use it as the pattern, but its imports point at that app's e2e helpers and its API paths are that app's, so it does not run as-is.
scene.tsexportsopenScene(browser, baseURL, label)and theScenetype. A scene is one signed-in page per capture path with its own workspace (a folder, a project, a record) that is deleted onclose(), so paths never see each other's rows. It must offerpage,settle(),hold(url)returning{release, abort}, andclose().abortkeeps failing matching requests untilrelease, because a transport that retries 5xx never shows the failed state otherwise.playwright.config.tssetsOUT_DIR, one project, no retries,testMatchoncapture.spec.ts, and whatever server and user provisioning the app's e2e suite already has.
The app needs a running site that the e2e helpers can seed through its API. For a Frappe app, use frappe-app-dev to get the bench and site, and set allow_tests plus whatever the app's e2e suite needs (the example app also needed ignore_csrf 1 for uploads).