FactuGES_ERP/playwright.config.ts
David da362fef64 feat(e2e): implement end-to-end testing framework with database preparation and lifecycle management
- Add E2ESchemaDatabaseConfig interface for database configuration validation.
- Implement assertE2ESchemaDatabaseConfig function to enforce schema requirements.
- Create prepareE2ESchema function to handle schema preparation and initialization.
- Develop E2E lifecycle management functions to provision, prepare, and run tests.
- Introduce Docker Compose setup for E2E database environment.
- Add Playwright configuration for E2E testing.
- Implement various test cases to validate E2E schema preparation and lifecycle.
- Create utility functions for environment variable management and database assertions.
- Establish smoke tests to verify initial data setup and integrity.
2026-09-22 16:49:08 +02:00

45 lines
1.3 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
import {
assertOfficialE2EEnvironment,
assertOfficialE2EExecution,
} from "./tests/e2e/support/e2e-contract";
const localBaseUrl = "http://127.0.0.1:5173";
assertOfficialE2EExecution(process.env);
assertOfficialE2EEnvironment(process.env);
export default defineConfig({
testDir: "./tests/e2e",
testIgnore: "**/e2e-contract.test.ts",
timeout: 30_000,
expect: { timeout: 5_000 },
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
reporter: [["html", { open: "never" }]],
use: {
baseURL: localBaseUrl,
testIdAttribute: "data-testid",
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "retain-on-failure",
},
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
webServer: [
{
command:
"node --import=tsx tests/e2e/support/ensure-e2e-database.ts && cd apps/server && node --env-file=.env.e2e --import=tsx src/index.ts",
url: "http://127.0.0.1:3002/api/v1/__ready",
timeout: 120_000,
reuseExistingServer: false,
},
{
command: "cd apps/web && pnpm dev -- --mode e2e --port 5173",
url: localBaseUrl,
timeout: 120_000,
reuseExistingServer: false,
},
],
});