Skip to content

Recipes

End-to-end working examples for both the Playwright-test and the AI-agent workflows.

RecipeWhat it shows
Annotate on assertion failureWrap an assertion in try/catch and annotate the locator that misbehaved.
Annotate on failure with the DSLSame flow with the typed annotation DSLintent: "error" instead of raw hex, callout instead of three string-concatenated helpers.
Draw by DOM locatorUse locator.boundingBox() + rectForBoundingBox to draw an exact overlay rectangle.
Attach to the HTML reportLand the annotated PNG inline next to the failing step.
RecipeWhat it shows
Agent bug-report autopilotLocator-first MCP workflow: navigate → identify broken element → file a GitHub issue with annotated screenshot in one turn.
Generate a manual from screenshotsCombine MCP capture + DSL annotations + the encode pipeline (format: "smart" + saveSizePreset) for ~3–5× smaller per-step bytes. Includes a link to the living-product-docs recipe for the kept-in-sync flavour.
Living product docsDrive annot-product-docs + -astro + -xlsx from a Playwright tour — generate a docs site and an Excel screen-specifications spreadsheet from the same MDX, kept in sync with snapshots.

Each recipe is self-contained — copy-paste it into a new example.spec.ts (or paste the MCP payload into your agent’s prompt), install the packages, and it works against any URL.