Skip to content
/
All docs pages

Reference

Playwright checks

Every feedback item carries acceptance checks ("At 834px the title→price gap is space.4"). pinprompt turns them into a Playwright test, coding agents make that test pass, and CI runs it against the PR's preview and posts the result back to the item. The reporter sees Automated checks: 3 of 4 passed next to the checks in the sign-off panel, then decides. Passing checks never close an item.

spec ──toPlaywrightTest──▶ FB-1188.spec.ts ──agent adds it to the PR──▶ preview deploy
                                                                          │
item page / sign-off ◀── POST /api/v1/items/FB-1188/checks ◀── pinprompt-checks action

The generated test

GET /api/v1/items/FB-1188/playwright, the Checks tab on the item page (Download, Copy), or the MCP tool get_playwright_test. It's one self-contained file that imports only @playwright/test:

  • Anchor. ANCHOR holds the pinned element's CSS selector, its data-pinprompt-src (file:line, present on preview builds with @pinprompt/next) and its text. pinned(page) tries them in that order, so the test survives a renamed test id as long as the source mapping or the text still match.
  • Page and viewport. Tests open the reported page path on PINPROMPT_BASE_URL (the preview origin), or the reported URL when it isn't set. Checks are grouped by viewport: the check's own viewports, else "At 834px" in its text, else the viewport it was captured at.
  • Parts. Checks that name parts ("title", "price", "badge", "image", "drawer"…) look them up inside the pinned element through PARTS, most specific selector first ([data-testid$="title"], then [class*="title"], then headings). Edit PARTS if your markup differs; keep the rest generated.
  • Tokens. space.N is read from the page's --space-N CSS variable when it defines one, else N × 4px. Lengths are compared within ±1px, colours within ±2 per channel.
  • Titles. Every test is titled AC-n · <check text> inside a describe named after the item, which is how results map back.

What becomes an assertion, and what doesn't:

Check saysBecomes
"title→price gap is space.4", "gap between the title and the price is 16px"the distance between the two parts' boxes
"Badge sits inside the image, inset space.3"the badge's box is inside the image's, and its two nearest edges are inset by 12px
"no product title takes more than two lines", "wraps to at most two lines"rendered line boxes of each title (all on the page with no / every, else inside the pinned element)
"Hint shows the CMS value (€40)", Button says "Add to cart"toContainText on the pinned element (or the named part)
No "€30" left in published contentnot.toContainText on the page
"Title font size is 20px", "Price colour is #6B6B6B", "padding is space.4", "font weight is bold"the computed style, within tolerance
"No horizontal scroll at 320px"scrollWidth <= clientWidth
"Logo links to /"the pinned element's link target
"Every footer link on /de returns 200", "no broken links"every same-origin link in that region is requested; the test lists the ones that didn't answer
"Drawer is visible within 100 ms of tapping Filter"click the pinned element, the drawer must be visible within 100 ms
"The badge is visible"toBeVisible
visual-diff checks, manual checks, behaviour ("Double-click Apply → one discount line", "posted twice → 409"), judgement callstest.fixme("AC-n · …") with the reason as a comment. They never pass on their own; the reporter checks them on the preview.

The compiler is deterministic (toPlaywrightTest(spec) in @pinprompt/compiler). An optional Claude pass (refinePlaywrightPlan) may turn fixme checks into assertions; its output must validate against the same plan schema and goes through the same renderer, so the file looks the same either way. It never touches visual-diff or manual checks.

CI: the pinprompt-checks action

.github/actions/pinprompt-checks is a composite action. For each run it:

  1. 1.finds the items for the change: items if given, plus items an agent attached this PR to (GET /api/v1/items?pr=<url>), plus keys in the PR title, body and branch (fix/FB-1188-card-spacing);
  2. 2.downloads each item's test and a Playwright config;
  3. 3.installs @playwright/test and Chromium, and runs the tests against preview-url;
  4. 4.posts each item's results to POST /api/v1/items/:key/checks and writes a job summary;
  5. 5.fails the job when an asserted check failed (fail-on-failure: false to only report).

Token

Create an agent for CI: Project settings → Agents → Add agent, name it CI, kind other, and copy its token into the repository's secrets as PINPROMPT_TOKEN. An agent token can read specs and post results for its own project only. It can't verify, close or merge anything. A personal token doesn't work here: it only makes the extension's calls (what the extension's token can do). The CI agent also keeps the activity feed honest: "CI ran FB-1188's checks: 2 of 2 passed".

Example: Vercel (or any deployment_status provider)

# .github/workflows/pinprompt-checks.yml
name: pinprompt checks
on: deployment_status

permissions:
  contents: read
  pull-requests: read   # to find the PR for the deployed commit

jobs:
  checks:
    if: github.event.deployment_status.state == 'success' && github.event.deployment.environment != 'Production'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/actions/pinprompt-checks   # or veren-tech/pinprompt/.github/actions/pinprompt-checks@main
        with:
          pinprompt-url: https://pinprompt.agency.dev
          token: ${{ secrets.PINPROMPT_TOKEN }}
          preview-url: ${{ github.event.deployment_status.environment_url }}
          github-token: ${{ secrets.GITHUB_TOKEN }}
          # protected previews:
          # http-headers: '{"x-vercel-protection-bypass": "${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}"}'

Example: a preview URL you build yourself

on: pull_request
jobs:
  checks:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # … deploy, then:
      - uses: ./.github/actions/pinprompt-checks
        with:
          pinprompt-url: https://pinprompt.agency.dev
          token: ${{ secrets.PINPROMPT_TOKEN }}
          preview-url: https://pr-${{ github.event.number }}.halden-staging.app

Inputs: pinprompt-url, token, preview-url (required); items, pr-url, github-token, http-headers, playwright-version (default 1.56.1), report (default true), fail-on-failure (default true), working-directory. Outputs: items, passed, failed.

Running locally does the same thing without GitHub:

export PINPROMPT_URL=http://localhost:3000 PINPROMPT_TOKEN=pp_… PINPROMPT_OUT_DIR=/tmp/pp-checks PINPROMPT_ITEMS="FB-1188"
node .github/actions/pinprompt-checks/fetch-tests.mjs
(cd /tmp/pp-checks && npm i @playwright/[email protected] && PINPROMPT_BASE_URL=http://localhost:3100 npx playwright test -c playwright.config.mjs)
PINPROMPT_PREVIEW_URL=http://localhost:3100 node .github/actions/pinprompt-checks/post-results.mjs

The results API

POST /api/v1/items/:idOrKey/checks with an agent token (or a person with item.claim: developers, owners):

{
  "report": { "suites": [] },
  "results": [{ "id": "AC-1", "status": "passed" }, { "id": "AC-2", "status": "failed", "message": "badge stays inside the image" }],
  "previewUrl": "https://pr-215.halden-staging.app",
  "ciUrl": "https://github.com/halden/web/actions/runs/123",
  "prUrl": "https://github.com/halden/web/pull/215",
  "commitSha": "4f2c1a9",
  "specVersion": 2
}

Send report (Playwright's JSON reporter output; tests are matched by AC-n title under a describe or file named after the key) or results, or both (results win). Up to 2 MB. The answer (201) is the recorded run: passed, failed, skipped (the fixme ones) and one row per acceptance check of that spec version, not_run when CI didn't report it.

What happens:

  • the run is stored on the item's thread as a team-only line ("Automated checks: 1 of 2 passed on pr-215.halden-staging.app · failing: AC-1"), and ItemDetail.checks is the latest run;
  • an item.checks_reported event is written (payload: key, runId, specVersion, passed, failed, skipped, previewUrl, ciUrl, commitSha), so integrations can react;
  • the item's status does not change. Not to Done (only people close items), and not back to the agent either: a red run on a preview that's still deploying shouldn't bounce an item on its own. The reporter sees the result in the sign-off panel and fails it with a note when it's really wrong; that note becomes a new check.

GET /api/v1/items/:idOrKey/checks lists runs, newest first. Clients never see runs, generated tests, selectors or source paths.

Where it shows

  • Item page → Checks tab: the latest run per check (passed, failed with the assertion message, by hand, not run), preview, commit, CI link, and the test file with Copy and Download. The tab's dot is green or red after a run.
  • Check the fix panel on the item page and the extension's sign-off popover: a dot per check from the latest run and "Automated checks: 3 of 4 passed".
  • Activity: "CI ran FB-1188's checks: 2 of 2 passed".