Prolifto
Developer guide

Testing

Run unit, integration, and end-to-end tests for critical workflows.

Prolifto uses Vitest for unit and integration tests and Playwright for end-to-end tests. Test critical behavior: money, inventory, auth, tenant isolation, billing, security, and primary user journeys.

Unit tests

pnpm test                              # all workspaces
pnpm -F admin test                     # admin unit + integration
pnpm -F admin exec vitest run --project=unit
pnpm -F admin exec vitest run --project=integration
pnpm -F sdk test

Unit tests live next to the code or under apps/admin/test and do not need a database. Integration tests use the separate test database.

Integration tests

pnpm db:test:up
pnpm -F admin exec vitest run --project=integration

Integration tests use TEST_DATABASE_URL and run serially. They cover order creation, checkout, payment confirmation, returns, coupon validation, inventory, and other stateful flows. Clean up or isolate the data you create.

Reset the test database:

pnpm db:test:reset

End-to-end tests

Playwright covers the revenue-critical path: catalog, cart, coupons, guest checkout with cash on delivery, and verifying the order in the admin.

  1. Copy apps/e2e/.env.e2e.example to apps/e2e/.env.e2e.
  2. Point DATABASE_URL at a database with the schema pushed.
  3. Run:
pnpm e2e

The suite seeds an e2e-store organization and an e2e-admin@prolifto.test user, builds dedicated apps on ports 3100 (admin) and 3101 (storefront), and only mutates that test data.

Interactive runs:

pnpm e2e:ui
pnpm -F e2e exec playwright test <spec> --debug=cli

Snapshots, traces, and CLI output go to .playwright-cli/ (git-ignored).

What to test

  • Money: totals, discounts, shipping, refunds, currency rounding.
  • Inventory: stock decrement, restore, low-stock thresholds.
  • Auth and tenancy: permissions, API keys, organization scoping.
  • Billing: plan limits, subscription lifecycle.
  • Primary journeys: checkout, order confirmation, admin fulfillment.

Do not add tests for presentational UI, static mappings, date/Intl formatting, thin wrappers, or third-party library behavior. Do not chase coverage percentages; test:coverage is informational.

CI

The CI workflow runs:

  • pnpm check (Biome/Ultracite)
  • pnpm check-types
  • pnpm test with a PostgreSQL service
  • pnpm e2e with a PostgreSQL service and Mailpit

Keep the suite deterministic and fast enough for CI. A regression test should accompany a critical-path bug fix.

On this page