# Testing with Playwright and Vitest

> Run E2E and unit tests with the scripts currently shipped in the repo.

*Canonical: https://makerkit.dev/docs/nextjs-drizzle/testing/overview*

---

The repo uses:

- Playwright for E2E tests in `apps/e2e`
- Vitest for package-level unit tests

## Quick Start

Run unit tests:

```bash
pnpm test:unit
```

Run E2E tests against a built web app:

```bash
pnpm --filter web build:test
PLAYWRIGHT_SERVER_COMMAND='pnpm --filter web start:test' pnpm --filter web-e2e test:slow
```

If you prefer to start the app yourself in another terminal:

```bash
pnpm --filter web start:test
pnpm --filter web-e2e test:slow
```

## What Is Covered

- auth flows
- invitations and members flows
- admin flows
- settings flows
- package-level service and utility tests

## Environment Setup

E2E tests expect:

- PostgreSQL running
- `apps/e2e/.env` configured
- Mailpit available for email-based flows

The E2E suite seeds the database in Playwright global setup.

## Topics

1. [E2E Testing with Playwright](./e2e)
2. [Unit Testing with Vitest](./unit)
3. [Writing Your Own Tests](./writing-tests)
