A complete loop for defining, generating, running and gating tests: - qa/: scenario-card template + examples (API/UI/binding), the Claude generation prompt, and a QA runbook tying it together - e2e/CLAUDE.md: conventions that keep AI-generated tests consistent - run-tests.ps1: one runner for every layer (backend/api/web/ui/binding), logs per run under .testlogs/, JUnit output, evidence report, and a re-seed guard against stale demo data - .githooks/ + scripts/install-hooks.ps1: pre-commit secret scan and pre-push unit tests (shift-left before CI) - evidence report now captures each API call's request, payload and response (Authorization redacted); JUnit reporter added for CI - scripts/db.mjs: db:check freshness guard Azure DevOps pipeline deferred; the runner already emits JUnit + the evidence report for any CI to publish. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
90 lines
2.8 KiB
TypeScript
90 lines
2.8 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
const WEB = process.env.E2E_BASE_URL ?? 'http://localhost:4200';
|
|
const API = process.env.E2E_API_URL ?? 'http://localhost:8080';
|
|
|
|
export default defineConfig({
|
|
testDir: './tests',
|
|
outputDir: './test-results',
|
|
|
|
// These tests share one database, and several of them assert on seat counts
|
|
// and booking totals. Running a single worker keeps those assertions
|
|
// meaningful; the suite is small enough that the wall-clock cost is minor.
|
|
workers: 1,
|
|
fullyParallel: false,
|
|
|
|
// A stray test.only should fail the build rather than silently skip the suite.
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
|
|
timeout: 60_000,
|
|
expect: { timeout: 10_000 },
|
|
|
|
// The evidence reporter turns the screenshots and data captured by passing
|
|
// tests into a readable run report; the html one stays for debugging failures.
|
|
// junit.xml is the machine-readable result any CI (Azure DevOps, Gitea) can
|
|
// ingest; the evidence reporter is the human record; html is for debugging.
|
|
reporter: process.env.CI
|
|
? [
|
|
['github'],
|
|
['junit', { outputFile: 'results/junit.xml' }],
|
|
['html', { open: 'never' }],
|
|
['./reporters/evidence.ts'],
|
|
['list'],
|
|
]
|
|
: [
|
|
['junit', { outputFile: 'results/junit.xml' }],
|
|
['html', { open: 'never' }],
|
|
['./reporters/evidence.ts'],
|
|
['list'],
|
|
],
|
|
|
|
use: {
|
|
baseURL: WEB,
|
|
trace: 'retain-on-failure',
|
|
// 'on' rather than 'only-on-failure': the evidence report is a record of
|
|
// what passed, so every test contributes at least a final screenshot.
|
|
screenshot: 'on',
|
|
video: 'retain-on-failure',
|
|
actionTimeout: 15_000,
|
|
},
|
|
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'], viewport: { width: 1440, height: 900 } },
|
|
},
|
|
// A narrow viewport, because the console is built to work on a phone too.
|
|
// Only the read-mostly specs run here: the booking flows write to a shared
|
|
// database, and running them twice would churn the demo data for no gain.
|
|
{
|
|
name: 'mobile-chrome',
|
|
use: { ...devices['Pixel 7'] },
|
|
testMatch: /(auth|responsive)\.spec\.ts/,
|
|
},
|
|
],
|
|
|
|
// Starts the Go API and the Angular dev server if they are not already up, so
|
|
// `npm test` is the only command a developer or CI job needs.
|
|
webServer: [
|
|
{
|
|
command: 'go run ./cmd/api',
|
|
cwd: '../backend',
|
|
url: `${API}/api/health`,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 180_000,
|
|
stdout: 'ignore',
|
|
stderr: 'pipe',
|
|
},
|
|
{
|
|
command: 'npm start',
|
|
cwd: '../frontend',
|
|
url: WEB,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 240_000,
|
|
stdout: 'ignore',
|
|
stderr: 'pipe',
|
|
},
|
|
],
|
|
});
|