-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplaywright.config.ts
40 lines (37 loc) · 1.03 KB
/
playwright.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import {defineConfig, devices} from '@playwright/test';
const DEV = (process.env.NODE_ENV ?? 'production') === 'development';
const TEMPLATE = process.env.TEMPLATE ?? 'test';
const PORT = TEMPLATE.includes('angular')
? 4200
: TEMPLATE.includes('astro')
? 4321
: TEMPLATE.includes('next')
? 3000
: 5173;
export default defineConfig({
webServer: [
{
command: `npm run dev --prefix templates/${TEMPLATE}`,
reuseExistingServer: true,
port: PORT
}
],
testDir: 'e2e',
testMatch: ['**/*.e2e.ts', '**/*.spec.ts'],
timeout: 60000,
use: {
testIdAttribute: 'data-tid',
trace: 'on',
...(DEV && {headless: false}),
screenshot: 'only-on-failure',
baseURL: `http://localhost:${PORT}`
},
projects: [
{
name: 'Google Chrome',
use: {...devices['Desktop Chrome'], channel: 'chrome'}
}
],
workers: process.env.CI ? 1 : undefined,
snapshotPathTemplate: `{testDir}/__screenshots__/${TEMPLATE}/${process.env.NODE_ENV ?? 'production'}/{testFilePath}/{arg}{ext}`
});