AGENT SKILL

running-vrts

Use whenever adding, updating, regenerating, running, or debugging visual regression tests (VRTs) / screenshot tests in the Actual Budget repo — including phrases like "add a VRT", "add a screenshot test", "update the snapshots", "regenerate the VRT screenshots", "the VRT is failing", "yarn vrt", "vrt:docker", or "/update-vrt", and any time a UI change needs screenshot coverage. VRT snapshots must be generated inside the Linux docker image (never on the host) and snapshot updates must be scoped to the changed test only — getting either wrong produces snapshots CI ignores or rewrites every screenshot in the repo.

License 许可
MIT
最近更新
2026-08-25
Stars
★ 3
Forks
1

01 前言 Front Matter

name
running-vrts
description
Use whenever adding, updating, regenerating, running, or debugging visual regression tests (VRTs) / screenshot tests in the Actual Budget repo — including phrases like "add a VRT", "add a screenshot test", "update the snapshots", "regenerate the VRT screenshots", "the VRT is failing", "yarn vrt", "vrt:docker", or "/update-vrt", and any time a UI change needs screenshot coverage. VRT snapshots must be generated inside the Linux docker image (never on the host) and snapshot updates must be scoped to the changed test only — getting either wrong produces snapshots CI ignores or rewrites every screenshot in the repo.

03 SKILL.md 正文

Running VRTs (Visual Regression Tests) in actualbudget/actual

VRTs are ordinary Playwright e2e tests in packages/desktop-client/e2e/*.test.ts that call:

await expect(target).toMatchThemeScreenshots();

toMatchThemeScreenshots() is a custom matcher defined in packages/desktop-client/e2e/fixtures.ts. target is a Page or a Locator — prefer a tight locator (e.g. a popover or panel) over the whole page to reduce noise from charts and data.

Key mechanics

  • No-op without VRT=true. In a plain e2e run the matcher passes immediately, so yarn workspace @actual-app/web run playwright test <file> -g "<name>" verifies the interaction flow cheaply without needing snapshots — always do this first.
  • With VRT=true, each call captures three themes (auto i.e. light, dark, midnight), producing numbered snapshots: <file>.test.ts-snapshots/<Describe>-<test-name>-N-chromium-linux.png. One test with 2 assertions → 6 PNGs.
  • Masking: elements with data-vrt-mask="true" are masked out of screenshots. Use it for volatile content (real dates, version numbers).
  • Diff tolerance is strict: maxDiffPixels: 5, threshold: 0.05 (packages/desktop-client/playwright.config.ts).
  • Snapshots are Linux-only. Committed snapshots end in -chromium-linux.png and must be generated inside the Playwright docker image. A host run on macOS writes -chromium-darwin.png, which CI ignores.

Writing a new VRT

Import from the local fixtures, not @playwright/test:

import { expect, test } from './fixtures';

Patterns to copy:

  • Date-picker popover VRT: e2e/transactions.test.ts ("by date").
  • Report VRTs: e2e/reports.test.ts.
  • Tests use the demo budget (ConfigurationPage.createTestFile()), whose data is pinned (date ranges show 2016), so snapshots are largely date-stable.
  • Popovers render with a [data-popover] attribute — a good screenshot locator.
  • Page models live in e2e/page-models/.

Generating snapshots locally (docker)

Run all yarn commands from the repo root.

  1. Start the dev server with HTTPS (background it; ready when https://localhost:3001 returns 200 — ignoreHTTPSErrors is already set in the Playwright config):

    HTTPS=true yarn start
    
  2. The container runs with --network host. On Linux it can reach https://localhost:3001 directly. On macOS/Windows it cannot — get the machine's LAN IP (ipconfig getifaddr en0 on macOS) and use https://<LAN_IP>:3001 instead.

  3. Run the Playwright docker image directly. The bin/run-vrt wrapper passes -it, which fails without a TTY, so in an agent shell invoke docker yourself:

    docker run --rm --network host -v "$(pwd)":/work/ -w /work/ \
      mcr.microsoft.com/playwright:v1.61.1-jammy /bin/bash -c \
      "E2E_START_URL=https://<HOST>:3001 yarn vrt --update-snapshots -g '<test name>' <file>.test.ts"
    

    Pin the image tag to the repo's Playwright version (@playwright/test in packages/desktop-client/package.json — currently 1.61.1 → v1.61.1-jammy). The equivalent user-facing wrapper is yarn vrt:docker --e2e-start-url https://<HOST>:3001 --update-snapshots.

  4. Always scope --update-snapshots with -g/file args to the new or changed test only — an unscoped update rewrites every screenshot in the repo.

  5. Verify by re-running the exact same command without --update-snapshots; it must pass.

  6. Optionally Read one generated PNG to sanity-check it shows the intended UI, then commit the test + PNGs (commit messages need the [AI] prefix — see the committing-actual-changes skill).

Fallback without docker

Commit only the test file; CI generates the snapshots when someone comments /update-vrt on the PR (.github/workflows/vrt-update-generate.yml).

04 同仓库更多 Skills

XYavecasdf
XYavecasdf/actual-multicurrency

writing-release-notes

Use whenever adding, writing, drafting, or fixing a release note in the Actual Budget repo. This is the changelog entry that ships with a code change, living as a Markdown file in `upcoming-release-notes/`. Trigger for asks like "add a release note", "write the changelog entry", "add the release note for this PR/change", "create the upcoming release note", or any time finishing a user-facing change in this repo where a release note is the natural next step. These notes are published for humans to read, so they must be short, plain-language, and free of technical detail. Writing them like a commit message or with implementation jargon produces entries that get flagged and rewritten in review.

★ 3
XYavecasdf
XYavecasdf/actual-multicurrency

writing-actual-docs

Use whenever creating, updating, editing, drafting, restructuring, or fixing documentation in the Actual Budget repo — specifically anything under `packages/docs/` (the Docusaurus site published at actualbudget.org/docs) or any change to `.md` / `.mdx` files in that package. Trigger for asks like "add a doc page for X", "update the FAQ", "write a guide for the new feature", "document this setting", "fix the docs about Y", "add a contributing page", or any work on the docs site, even when the user does not explicitly mention style, structure, or conventions. Actual's docs follow strict Docusaurus conventions (front matter, heading levels, image placement and naming, admonition syntax, Title Case, tone of voice, spelling allowlist) and writing them without consulting the project's style guide reliably produces output that fails review and needs to be redone.

★ 3
XYavecasdf
XYavecasdf/actual-multicurrency

review-actual-pr

Comprehensive review of a pull request in the actualbudget/actual repo. Performs an offline code review against the repo's CODE_REVIEW_GUIDELINES.md and AGENTS.md (no GitHub comments are ever posted), then browser-tests the change with playwright-cli. For bug PRs, reproduces the issue on edge.actualbudget.org first and verifies the fix on the Netlify preview; for feature/enhancement PRs, exercises the change on the preview and captures annotated screenshots highlighting the new functionality. Use whenever the user asks to review, test, validate, vet, sanity-check, QA, or otherwise look at a PR / pull request in the Actual Budget repo — including phrases like "review

★ 3
XYavecasdf
XYavecasdf/actual-multicurrency

committing-actual-changes

Use whenever creating, drafting, finalizing, or amending a git commit or a pull request in the Actual Budget repo (actualbudget/actual) — including phrases like "commit this", "make a commit", "stage and commit", "open a PR", "create a pull request", "send this for review", "push these changes", "ship it", "submit a PR", "raise a PR", or any time finishing implementation work in this repo where committing or opening a PR is the natural next step. Also trigger when the user mentions the `[AI]` prefix, the PR template, git hooks, or `--no-verify` in this repo. The repo enforces strict, non-obvious rules for AI-generated contributions (mandatory `[AI]` prefix on every commit message and PR title, leaving the PR template blank, never skipping hooks, specific git-safety constraints, a pre-commit quality checklist) and not following them produces commits and PRs that have to be redone or manually fixed by a maintainer.

★ 3