Skip to content

Conversation

@Ovgodd
Copy link
Collaborator

@Ovgodd Ovgodd commented Nov 24, 2025

Purpose

Add a stable PDF export regression test that fails whenever the exported PDF for a full, complex document changes.

1. `npx playwright test __tests__/app-impress/doc-export.spec.ts --update-snapshots -g "full document" --project=chromium`
   -> refresh the reference PDF whenever we intentionally change the export output.
2. `npx playwright test __tests__/app-impress/doc-export.spec.ts -g "full document" --project=chromium`
   -> CI (and local runs without --update-snapshots) will compare the PDF to the reference
      and fail on any byte-level difference once the dynamic metadata has been sanitized.

Proposal

  • Seed a doc with a fixed title and a prebuilt BlockNote/Yjs content (content.txt) via the REST API (PATCH /documents/:id/), using X-CSRFToken from Playwright cookies.
  • Export to PDF on Chromium, sanitize dynamic metadata (dates, IDs, font prefixes),
    then compare bytes against a snapshot PDF.
  • Document how to maintain the snapshot (--update-snapshots vs. normal run) directly in the test.
  • Add print-datauris.js to generate PNG/JPG/SVG data URL helpers and update content.txt
    so the reference document includes embedded images via data URLs.

@Ovgodd Ovgodd requested a review from AntoLC November 24, 2025 12:46
@Ovgodd Ovgodd self-assigned this Nov 24, 2025
@Ovgodd Ovgodd added the enhancement improve an existing feature label Nov 24, 2025
@Ovgodd Ovgodd changed the title ✅(frontend) add test to compare generated PDF against reference template ✅(e2e) add test to compare generated PDF against reference template Nov 24, 2025
ensures no regression by validating PDF content matches the expected pattern

Signed-off-by: Cyril <c.gromoff@gmail.com>
@Ovgodd Ovgodd force-pushed the feat/e2e-export-reference-pdf branch 4 times, most recently from d2fbccd to f81aeaf Compare November 24, 2025 14:54
adds base64 png/jpg/svg image fixtures to stabilize pdf export snapshots

Signed-off-by: Cyril <c.gromoff@gmail.com>
@Ovgodd Ovgodd force-pushed the feat/e2e-export-reference-pdf branch from f81aeaf to eca0423 Compare November 24, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improve an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants