|
| 1 | +import * as path from 'node:path'; |
| 2 | + |
| 3 | +import { parseNumber } from '@douglasneuroinformatics/libjs'; |
| 4 | +import { defineConfig, devices } from '@playwright/test'; |
| 5 | + |
| 6 | +const API_PORT = parseNumber(process.env.API_DEV_SERVER_PORT); |
| 7 | +const WEB_PORT = parseNumber(process.env.WEB_DEV_SERVER_PORT); |
| 8 | + |
| 9 | +export default defineConfig({ |
| 10 | + fullyParallel: true, |
| 11 | + outputDir: path.resolve(import.meta.dirname, '.output/results'), |
| 12 | + projects: [ |
| 13 | + { |
| 14 | + name: 'Global Setup', |
| 15 | + teardown: 'Global Teardown', |
| 16 | + testMatch: '**/global/global.setup.spec.ts' |
| 17 | + }, |
| 18 | + { |
| 19 | + name: 'Global Teardown', |
| 20 | + testMatch: '**/global/global.teardown.spec.ts' |
| 21 | + }, |
| 22 | + { |
| 23 | + dependencies: ['Global Setup'], |
| 24 | + name: 'Desktop Chrome', |
| 25 | + testIgnore: '**/global/**', |
| 26 | + use: { ...devices['Desktop Chrome'] } |
| 27 | + }, |
| 28 | + { |
| 29 | + dependencies: ['Global Setup'], |
| 30 | + name: 'Desktop Firefox', |
| 31 | + testIgnore: '**/global/**', |
| 32 | + use: { ...devices['Desktop Firefox'] } |
| 33 | + }, |
| 34 | + { |
| 35 | + dependencies: ['Global Setup'], |
| 36 | + name: 'Desktop Safari', |
| 37 | + testIgnore: '**/global/**', |
| 38 | + use: { ...devices['Desktop Safari'] } |
| 39 | + } |
| 40 | + ], |
| 41 | + reporter: [['html', { open: 'never', outputFolder: path.resolve(import.meta.dirname, '.output/report') }]], |
| 42 | + testDir: path.resolve(import.meta.dirname, 'src'), |
| 43 | + use: { |
| 44 | + baseURL: `http://localhost:${WEB_PORT}`, |
| 45 | + trace: 'on-first-retry' |
| 46 | + }, |
| 47 | + webServer: [ |
| 48 | + { |
| 49 | + command: 'pnpm dev:test', |
| 50 | + cwd: path.resolve(import.meta.dirname, '../../apps/api'), |
| 51 | + gracefulShutdown: { |
| 52 | + signal: 'SIGINT', |
| 53 | + timeout: 1000 |
| 54 | + }, |
| 55 | + url: `http://localhost:${API_PORT}` |
| 56 | + }, |
| 57 | + { |
| 58 | + command: 'pnpm dev:test', |
| 59 | + cwd: path.resolve(import.meta.dirname, '../../apps/web'), |
| 60 | + gracefulShutdown: { |
| 61 | + signal: 'SIGINT', |
| 62 | + timeout: 1000 |
| 63 | + }, |
| 64 | + url: `http://localhost:${WEB_PORT}` |
| 65 | + } |
| 66 | + ] |
| 67 | +}); |
0 commit comments