Skip to content

Run Playwright against the production build instead of the dev server in CI #97

@d-oit

Description

@d-oit

Summary

The current Playwright config starts the application with npm run dev and uses http://localhost:5173 as the base URL. The Vite config also sets important dev server headers for Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy, and the package scripts already define a production build via tsc && vite build.

Problem

Testing only the dev server proves the local development path, but it does not validate the production bundle or the production-serving path. That gap matters more in an application that uses SQLite WASM and browser capabilities affected by cross-origin isolation behavior.

Why this matters

A successful E2E run should give confidence that the app works after bundling, not only before bundling. Production-mode E2E catches issues around asset paths, code splitting, preview serving, and deployment-like headers that a dev server can mask.

Proposed scope

  • Update CI-oriented Playwright execution to build the app first and then run tests against vite preview or an equivalent production-like static server.
  • Keep the current dev-server workflow available for fast local debugging if it remains useful.
  • Add at least one smoke test that verifies startup and critical navigation on the built app.
  • Verify that the required cross-origin headers are present in the environment used for production-style E2E.

Acceptance criteria

  • CI runs E2E tests against a production build, not only npm run dev.
  • At least one smoke path covers app boot plus a core workflow on the built artifact.
  • Production-style serving preserves any headers needed for SQLite WASM or related browser features.
  • Local developer ergonomics remain acceptable, with a documented fast path for debugging tests.

Suggested implementation notes

  • One practical split is test:e2e for local dev-server execution and test:e2e:ci for npm run build && vite preview plus Playwright.
  • If preview headers differ from the deployment target, add a deployment-environment smoke check as a separate job.
  • Keep existing CI safety settings such as forbidOnly, retries in CI, screenshots on failure, and retained videos.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions