import { defineConfig, devices } from '@playwright/test' import path from 'path' import { fileURLToPath } from 'url' const __dirname = path.dirname(fileURLToPath(import.meta.url)) const repoRoot = path.resolve(__dirname, '..') const isWin = process.platform === 'win32' const mvn = isWin ? 'mvn.cmd' : 'mvn' const backendStart = isWin ? `cmd /c "${mvn} -pl jog-admin -am install -Dmaven.frontend.skip=true -DskipTests && ${mvn} -pl jog-admin spring-boot:run -Dmaven.frontend.skip=true -Dspring-boot.run.profiles=e2e"` : `${mvn} -pl jog-admin -am install -Dmaven.frontend.skip=true -DskipTests && ${mvn} -pl jog-admin spring-boot:run -Dmaven.frontend.skip=true -Dspring-boot.run.profiles=e2e` export default defineConfig({ testDir: './tests', timeout: 120_000, expect: { timeout: 15_000 }, fullyParallel: false, workers: 1, retries: 0, reporter: [['list']], use: { baseURL: 'http://localhost:5173', trace: 'on-first-retry', screenshot: 'only-on-failure', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, ], webServer: [ { command: backendStart, url: 'http://localhost:8080/api/public/captcha', reuseExistingServer: !process.env.CI, timeout: 300_000, cwd: repoRoot, }, { command: 'npm run dev', url: 'http://localhost:5173', reuseExistingServer: !process.env.CI, timeout: 120_000, cwd: path.join(repoRoot, 'jog-frontend'), }, ], })