- K6_ENDPOINTS_SUMMARY.md: Quick reference for all API endpoints with request/response shapes - K6_QUICK_START.md: Practical guide with executable examples for search, auth, listing, and payment load tests - Includes example K6 scripts, CI integration template, and troubleshooting - Complete with load test scenarios and reporting options Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
2.0 KiB
TypeScript
77 lines
2.0 KiB
TypeScript
import path from 'node:path';
|
|
import { defineConfig, devices } from '@playwright/test';
|
|
import { config } from 'dotenv';
|
|
|
|
// Load .env.test so webServer processes and tests use the test database
|
|
if (!process.env.CI) {
|
|
config({ path: path.resolve(__dirname, '.env.test'), override: true });
|
|
}
|
|
|
|
/**
|
|
* Playwright E2E configuration for Goodgo Platform.
|
|
*
|
|
* Projects:
|
|
* - "api" — tests against the NestJS API (port 3001)
|
|
* - "web" — tests against the Next.js frontend (port 3000)
|
|
*
|
|
* Database isolation:
|
|
* - globalSetup runs migrations + seed on the test DB
|
|
* - globalTeardown cleans up test-generated data after all tests
|
|
*/
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
globalSetup: './e2e/global-setup.ts',
|
|
globalTeardown: './e2e/global-teardown.ts',
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: process.env.CI
|
|
? [['html', { open: 'never' }], ['github']]
|
|
: [['html', { open: 'on-failure' }]],
|
|
|
|
use: {
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
|
|
projects: [
|
|
// API E2E tests — no browser needed, uses APIRequestContext
|
|
{
|
|
name: 'api',
|
|
testDir: './e2e/api',
|
|
use: {
|
|
baseURL: process.env.API_BASE_URL ?? 'http://localhost:3001/api/v1',
|
|
},
|
|
},
|
|
// Web E2E tests — Chromium browser
|
|
{
|
|
name: 'web',
|
|
testDir: './e2e/web',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
baseURL: process.env.WEB_BASE_URL ?? 'http://localhost:3000',
|
|
},
|
|
},
|
|
],
|
|
|
|
webServer: [
|
|
{
|
|
command: 'pnpm --filter @goodgo/api run dev',
|
|
url: 'http://localhost:3001/api/v1/docs',
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 60_000,
|
|
env: {
|
|
NODE_ENV: 'test',
|
|
DATABASE_URL: process.env.DATABASE_URL ?? '',
|
|
},
|
|
},
|
|
{
|
|
command: 'pnpm --filter @goodgo/web run dev',
|
|
url: 'http://localhost:3000',
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 30_000,
|
|
},
|
|
],
|
|
});
|