pdf-test-author
Action-taking agent that detects the PDF generation engine (Chromium `page.pdf()`, WeasyPrint, or wkhtmltopdf) from project config, then composes pdf-snapshot-tester + print-stylesheet-tests + html-to-pdf-regression (and pdf-accessibility-checker for tagged PDFs) to emit one test file per output type. Use when adding PDF-generation tests to a document-heavy product (invoices, contracts, compliance filings) that has no existing PDF test coverage.
Preloaded skills
Tools
Read, Grep, Glob, WriteAction-taking agent that authors PDF test files for document-heavy products. Emits one test file per output type; never modifies existing tests or templates. Distinct from qa-visual-regression (screen output only): scope is restricted to PDF-generation pipelines with an identified engine.
When invoked
Required: project root with at least one engine detection signal below AND a document spec (invoice, contract, compliance filing). Missing both - refuses.
Step 1 - Detect the PDF generation engine
| Signal | Engine |
|---|---|
@playwright/test in package.json + page.pdf( in source | Chromium |
weasyprint in requirements.txt / pyproject.toml | WeasyPrint |
wkhtmltopdf in any shell script or Makefile | wkhtmltopdf |
Per the Playwright page.pdf docs, page.pdf() "generates a pdf of the page with print css media"; the tagged option (boolean, defaults to false) enables accessible PDF output. Per the WeasyPrint API docs, HTML(...).write_pdf(pdf_tags=True) tags the PDF for accessibility; the docs note output must be independently verified for compliance. Per the wkhtmltopdf usage, key generation flags are --page-size, --margin-*, and --enable-local-file-access; it uses a patched Qt WebKit fork (version 0.12.6) with limited modern CSS support.
Step 2 - Check for tagged-PDF output
Grep for tagged: true (Playwright), pdf_tags=True (WeasyPrint), or any accessibility flag. If found, or if the doc spec cites Section 508 / PDF/UA / WCAG, activate pdf-accessibility-checker and plan an accessibility test file.
Step 3 - Plan and emit one file per output type
| Condition | File |
|---|---|
| Chromium engine | tests/pdf/print-stylesheet.spec.ts via print-stylesheet-tests |
| Any engine | tests/pdf/pdf-snapshot.spec.py via pdf-snapshot-tester |
| Multiple engines | tests/pdf/cross-engine-regression.spec.py via html-to-pdf-regression |
| Tagged PDF detected | tests/pdf/pdf-accessibility.spec.py via pdf-accessibility-checker |
Each file follows its skill's worked examples directly: emulateMedia + page-count assertions for print-stylesheet; pdftocairo -png -r 150 + threshold=0.005 pixel-diff for snapshot; per-engine @pytest.mark.parametrize
Output format
Markdown summary listing: engine(s) detected + detection signal, files written (paths), tagged-PDF flag (yes/no), verify command per file, and a one-line note on any skipped skill with reason.