Skip to content

feat: layout snapshot testing#2035

Merged
harbournick merged 10 commits intomainfrom
nick/layout-snapshot-testing
Feb 16, 2026
Merged

feat: layout snapshot testing#2035
harbournick merged 10 commits intomainfrom
nick/layout-snapshot-testing

Conversation

@harbournick
Copy link
Collaborator

@harbournick harbournick commented Feb 16, 2026

Summary

  • Layout snapshot testing: New test infrastructure that exports layout JSON for every .docx in the test
    corpus, compares candidate (local) snapshots against reference (published npm version) snapshots, and generates
    diff reports.
  • Unified doc corpus: Extracts shared corpus download/upload tooling into scripts/corpus/ so both visual
    tests and layout snapshot tests use the same pipeline and registry.
  • Visual test integration: Layout comparisons automatically trigger visual regression tests for only the
    changed documents.
  • Registry safety: Prevents silent overwrite of existing corpus entries and handles dangling symlinks.
  • Report improvements: Adds "Open in Word" button to the visual testing HTML report.

Key changes

  • tests/layout-snapshots/ — snapshot exporter, npm-version exporter, comparator, and diff report generator
  • scripts/corpus/ — shared pull.mjs / push.mjs / shared.mjs for R2-backed doc corpus
  • devtools/visual-testing/ — updated to use shared corpus, scoped visual runs on snapshot diff
  • Root package.json — new scripts: corpus:pull, corpus:push, layout:snapshots, layout:compare

Usage

pnpm corpus:pull                  # download test docs
pnpm layout:snapshots             # export candidate layout JSON
pnpm layout:compare               # compare against npm reference + auto visual diff

@harbournick harbournick self-assigned this Feb 16, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7ad5f82b65

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@harbournick harbournick merged commit b070cd7 into main Feb 16, 2026
4 checks passed
@harbournick harbournick deleted the nick/layout-snapshot-testing branch February 16, 2026 07:12
@superdoc-bot
Copy link
Contributor

superdoc-bot bot commented Feb 16, 2026

🎉 This PR is included in superdoc v1.14.0-next.1

The release is available on GitHub release

harbournick pushed a commit that referenced this pull request Feb 17, 2026
# [1.14.0](v1.13.1...v1.14.0) (2026-02-17)

### Bug Fixes

* **build:** remove dead vite-plugin-node-polyfills from UMD externals ([91de1fc](91de1fc))
* **converter:** handle empty rPrChange run properties without dropping tracked-style runs ([c25d24d](c25d24d))
* correctly pass table info when deriving inline run properties (SD-1865) ([#2007](#2007)) ([d752aff](d752aff))
* replace Node.js Buffer APIs with browser-native alternatives ([#2028](#2028)) ([b17774a](b17774a)), closes [#exportProcessMediaFiles](https://github.com/superdoc-dev/superdoc/issues/exportProcessMediaFiles)
* **tracked-changes:** colors should be restored when format rejected ([#1970](#1970)) ([01ea504](01ea504))

### Features

* add pdf infra, migrate layers ([#2078](#2078)) ([7d416e9](7d416e9))
* layout snapshot testing ([#2035](#2035)) ([b070cd7](b070cd7))
@harbournick
Copy link
Collaborator Author

🎉 This PR is included in superdoc v1.14.0

The release is available on GitHub release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant