Files
blog/frontend/playwright.config.ts
T

36 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-09-11 11:41:52 +02:00
import { fileURLToPath } from 'node:url'
import { defineConfig, devices } from '@playwright/test'
// Fixed ports so the PocketBase instance (started in global-setup.ts) and the
// built Nuxt server (started by Playwright's webServer below) can reference
// each other statically — see tests/e2e/global-setup.ts for why.
export const E2E_POCKETBASE_PORT = 8095
const APP_PORT = 3100
const BASE_URL = `http://127.0.0.1:${APP_PORT}`
const POCKETBASE_URL = `http://127.0.0.1:${E2E_POCKETBASE_PORT}`
export default defineConfig({
testDir: '../tests/e2e',
fullyParallel: false,
retries: 0,
reporter: [['list']],
use: {
baseURL: BASE_URL,
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
globalSetup: fileURLToPath(new URL('../tests/e2e/global-setup.ts', import.meta.url)),
webServer: {
command: 'npm run build && node .output/server/index.mjs',
url: BASE_URL,
reuseExistingServer: false,
timeout: 120000,
env: {
HOST: '127.0.0.1',
PORT: String(APP_PORT),
NUXT_POCKETBASE_URL: POCKETBASE_URL,
NUXT_PUBLIC_POCKETBASE_URL: POCKETBASE_URL,
NUXT_PUBLIC_SITE_URL: BASE_URL,
},
},
})