lilith-platform.live/deployments/playwright-e2e-docker/playwright.config.ts
2026-04-15 20:26:42 -07:00

82 lines
2.6 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
import { join } from 'node:path';
// __dirname is provided by Playwright's CJS TypeScript transform.
const REPO_ROOT = join(__dirname, '../../');
const ADMIN_DIST = join(REPO_ROOT, 'codebase/@features/admin/frontend-public/dist');
const MY_DIST = join(REPO_ROOT, 'codebase/@features/my/frontend-public/dist');
const PROXY_SERVER = join(REPO_ROOT, 'deployments/@domains/quinn.admin/e2e/proxy-server.ts');
const WWW_ROOT = join(REPO_ROOT, 'deployments/@domains/quinn.www/root');
export default defineConfig({
testDir: './e2e',
timeout: 45_000,
expect: { timeout: 10_000 },
retries: 0,
workers: 1,
reporter: 'list',
globalSetup: './e2e/global-setup.ts',
projects: [
{
name: 'admin',
use: { ...devices['Desktop Chrome'], baseURL: 'http://localhost:5120' },
testMatch: ['**/admin.spec.ts'],
},
{
name: 'www',
use: { ...devices['Desktop Chrome'], baseURL: 'http://localhost:5199' },
testMatch: ['**/www.spec.ts'],
},
{
name: 'integration',
use: { ...devices['Desktop Chrome'], baseURL: 'http://localhost:5199' },
testMatch: ['**/integration.spec.ts', '**/bookings.spec.ts'],
},
{
name: 'my',
use: { ...devices['Desktop Chrome'], baseURL: 'http://localhost:5125' },
testMatch: ['**/my.spec.ts'],
},
{
// Pure HTTP assertions against the data-api (no browser baseURL needed).
// Verifies the CSS_TRAPS_JSON → restoreKey pipeline that the quinn.www
// smoke suite cannot reach because it mocks /provider-api/api/data.
name: 'provider-api',
use: { ...devices['Desktop Chrome'] },
testMatch: ['**/provider-api.spec.ts'],
},
],
webServer: [
{
// Serves built admin frontend dist and proxies /api/ /auth/ /health /photos/ to admin API.
command: `tsx ${PROXY_SERVER} ${ADMIN_DIST} 3099 5120`,
port: 5120,
reuseExistingServer: false,
timeout: 15_000,
stdout: 'pipe',
stderr: 'pipe',
},
{
// Serves www frontend preview built by global-setup with VITE_DATA_API_URL=localhost:3022.
command: 'bun --bun run preview',
cwd: WWW_ROOT,
port: 5199,
reuseExistingServer: false,
timeout: 15_000,
stdout: 'pipe',
stderr: 'pipe',
},
{
// Serves built quinn.my frontend dist and proxies /api/ /auth/ /health to quinn.my API.
command: `tsx ${PROXY_SERVER} ${MY_DIST} 3025 5125`,
port: 5125,
reuseExistingServer: false,
timeout: 15_000,
stdout: 'pipe',
stderr: 'pipe',
},
],
});