Skip to main content
File flows break in subtle ways: invalid MIME handling, upload progress issues, parser errors, and corrupted downloads. This guide covers the highest-value Playwright checks.

Upload Test Pattern

Use deterministic fixture files and assert server-side result, not just UI success toasts.
tests/files/upload.spec.ts

Download Test Pattern

Validate filename and file size to catch empty or malformed downloads.
tests/files/download.spec.ts

Validation Cases You Should Not Skip

  • Oversized files are rejected with clear error text.
  • Invalid type (.exe, wrong MIME) is blocked.
  • Malformed CSV or JSON shows row-level error details.
  • Duplicate uploads are idempotent or clearly prevented.
  • Upload cancellation leaves no partial server records.

Keep Upload Tests Stable

  • Avoid random fixture data unless uniqueness is required.
  • Use a small fixture for smoke tests and a large one for stress tests.
  • Clean up created records by exact IDs after test completion.

Stably Features to Use for File Workflows