Files
template-showcase/playwright.config.ts

56 lines
1.9 KiB
TypeScript

import { defineConfig } from '@playwright/test'
// The app runs against the fake platform in e2e/fake-platform.mjs. The optional
// module variables are withheld, so the dashboard shows every enable card (plan D13).
const platform = 'http://127.0.0.1:4010'
// The variables of the optional modules, withheld from the app under test.
const optional = new Set([
'NATS_URL',
'NATS_TOKEN',
'QDRANT_URL',
'QDRANT_API_KEY',
'REDIS_URL',
'GIT_URL',
'AWS_ENDPOINT_URL',
'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY',
])
const base = Object.fromEntries(
Object.entries(process.env).filter((entry): entry is [string, string] => entry[1] !== undefined && !optional.has(entry[0])),
)
export default defineConfig({
testDir: 'e2e',
workers: 1,
reporter: [['list']],
use: { baseURL: 'http://localhost:3000' },
webServer: [
{
command: 'node e2e/fake-platform.mjs',
url: `${platform}/__e2e/health`,
reuseExistingServer: false,
},
{
command: 'npm run start',
url: 'http://localhost:3000/api/health',
reuseExistingServer: false,
timeout: 120_000,
env: {
...base,
CONUSAI_API_URL: `${platform}/api`,
CONUSAI_API_TOKEN: 'e2e-deployment-token',
CONUSAI_PROJECT_ID: 'e2e',
CONUSAI_DSN: "http://e2e@127.0.0.1:4010/1",
CONUSAI_RELEASE: 'e2e',
// Mirrors env_resolver.rs's OTEL_* derivation from CONUSAI_API_URL/CONUSAI_API_TOKEN
// (showcase D23): without these, register() never calls initOtlp() and the otlp e2e
// spec would pass for the wrong reason (nothing ever attempted, rather than delivered).
OTEL_EXPORTER_OTLP_ENDPOINT: `${platform}/api/otel`,
OTEL_EXPORTER_OTLP_PROTOCOL: 'http/protobuf',
OTEL_EXPORTER_OTLP_HEADERS: 'Authorization=Bearer e2e-deployment-token',
OTEL_SERVICE_NAME: 'showcase-e2e',
},
},
],
})