Files
pad/web/e2e
xarmian 272868291c test(e2e): web export → import round-trip with attachment (TASK-894) (#310)
Closes PLAN-890's regression-safety net: a Playwright spec that
seeds a source workspace with an item embedding a real PNG
attachment, drives the bundle export through the settings page,
imports it through the Create Workspace modal, and verifies via the
API that the imported workspace carries the item, the rewritten
attachment reference, and the rehydrated blob with bytes matching
the original upload.

Failure modes the spec catches:

- Export link reverts to JSON (toHaveAttribute on href + download)
- Import dispatch silently routes to the legacy JSON path (server
  would fail with gzip decode)
- Attachment id rewrite regresses (asserts the new content does
  NOT contain the OLD UUID and DOES contain a fresh UUID)
- Storage/rehydrate path corrupts bytes (assert downloaded blob
  bytes equal the original PNG)

Implementation notes:

- Bundle bytes are fetched via the auth'd `request` fixture, not
  via the browser's `<a download>` click. Playwright's download
  fork doesn't carry extraHTTPHeaders (Bearer token), so the
  click would 401. The link's href + download attribute are still
  asserted via toHaveAttribute — that pins the export-side UI
  contract.
- Modal is opened via a dual-path selector: TopBar's "+ New
  workspace" button when visible, falling back to the
  WorkspaceSwitcher dropdown's "+ New Workspace" entry. Same
  uiStore.createWorkspaceOpen flag, same modal — different chrome
  on different viewports.
- Spec is pinned to desktop-chromium. Running both projects in
  parallel trips the server's general-API rate limit
  (~10 req/sec) because seed + export + import + verify makes
  ~30 calls per worker. The flow has no viewport-specific code
  worth covering twice; one project is sufficient for round-trip
  integrity. Documented in the inline `test.skip`.
- 1x1 PNG byte sequence is the same as Go's realPNG() — same
  bytes the server-side attachment tests use, so the e2e
  exercises the same MIME-validation path.

Parent: PLAN-890.
2026-04-29 20:49:37 -04:00
..