feat(visual): add layout:screenshot-one CLI - #3104
Conversation
One-shot Playwright capture for a single .docx mirroring layout:export-one. Boots the visual harness vite server, drives chromium directly (no test runner), writes one PNG per rendered page plus metadata.json. Used by the render-parity artifact bundle to pair Word and SuperDoc renders. The pre-flight checks that packages/superdoc/dist exists so callers see an actionable error rather than an opaque vite 500 when the build is missing.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f3f27f207
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f3f27f207
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Address Codex review on #3104. Partial capture (P1): replace `break` on scrollIntoView failure with a throw, plus a post-loop captured != pageCount guard. The prior pattern was lifted from the visual-test fixture where a soft skip is fine for trailing blank pages, but for an artifact bundle a partial set silently corrupts downstream pairing. Stale images (P2): clear page-NNN.png from the output directory before capture so reusing a directory across runs cannot leak old pages into the current bundle. metadata.json continues to be overwritten. Drop `pageCountReported` since pageCount and pageCountReported are now invariantly equal under the throw-on-partial rule.
One-shot Playwright capture for a single .docx, mirroring
layout:export-one. Boots the visual harness vite server, drives chromium directly without the test runner, writes one PNG per rendered page plus ametadata.jsonalongside.A generic primitive intended for downstream evaluation tooling that compares SuperDoc page images against external references.
<dir>/page-001.png,page-002.png, ...,metadata.json(capturedAt, docxSha256, pipeline, pageCount, viewport).layout:export-one(headless|presentation, default presentation).packages/superdoc/distis missing, instead of an opaque vite 500 from the harness.AIDEV-NOTE:on the harnesssuperdocReadyre-init coupling -harness/main.tsresets the flag on every file-input change, so we reset it ourselves beforesetInputFilesto avoid waiting on the stale empty-doc ready state.Verified: smoke on
evals/fixtures/docs/basic-list.docx(1 page) andemployment-offer.docx(2 pages); PNGs 816x1056 (US Letter @ 96dpi), metadata correct.