f2b9239d82
Adds the initial testing baseline for the project: Unit coverage: - Zod schemas for items, assignments, movements, categories, auth, recipients, users, and assets - password hashing and verification helpers - auth role helper functions Integration coverage with PostgreSQL Testcontainers: - item use-cases: create, duplicate names, delete constraints - assignment use-cases: create, insufficient stock, return, double return - asset use-cases: available/assigned creation and lifecycle transitions - user use-cases: create/update, uniqueness, admin safeguards, password reset - category use-cases: create/update/delete constraints - recipient use-cases: create/update and uniqueness constraints E2E smoke coverage with Playwright: - unauthenticated redirect to login - seeded admin login - dashboard load - admin users page - inventory items page - assignments page Also configures: - Vitest - Playwright - PostgreSQL Testcontainers helpers - deterministic E2E admin bootstrap - test artifact ignores Validation: - bun run test: 9 files / 37 tests passed - bun run test:e2e: 3 passed - bunx tsc --noEmit: passed - bunx prisma validate: passed
31 lines
675 B
TypeScript
31 lines
675 B
TypeScript
import { defineConfig, devices } from "@playwright/test"
|
|
|
|
const port = process.env.E2E_PORT ?? "3100"
|
|
const baseURL = `http://127.0.0.1:${port}`
|
|
|
|
export default defineConfig({
|
|
testDir: "./tests/e2e",
|
|
testMatch: "**/*.spec.ts",
|
|
timeout: 60_000,
|
|
fullyParallel: false,
|
|
workers: 1,
|
|
retries: process.env.CI ? 2 : 0,
|
|
reporter: process.env.CI ? "github" : "list",
|
|
use: {
|
|
baseURL,
|
|
trace: "on-first-retry",
|
|
},
|
|
projects: [
|
|
{
|
|
name: "chromium",
|
|
use: { ...devices["Desktop Chrome"] },
|
|
},
|
|
],
|
|
webServer: {
|
|
command: "bun tests/e2e/support/e2e-server.ts",
|
|
url: baseURL,
|
|
timeout: 180_000,
|
|
reuseExistingServer: false,
|
|
},
|
|
})
|