-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
49 lines (42 loc) · 1.2 KB
/
playwright.config.ts
File metadata and controls
49 lines (42 loc) · 1.2 KB
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
41
42
43
44
45
46
47
48
49
import { defineConfig, devices } from '@playwright/test';
const isPreview = process.env.PW_MODE === 'preview';
const isScreenshots = process.env.PW_SCREENSHOTS === '1';
const port = isPreview ? 4321 : 4322;
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 1,
workers: process.env.CI ? 1 : undefined,
reporter: 'list',
timeout: 15_000,
use: {
baseURL: `http://localhost:${port}`,
screenshot: 'only-on-failure',
video: 'off',
trace: 'on-first-retry',
},
outputDir: 'test-results',
projects: [
{
name: 'desktop',
use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 720 } },
},
{
name: 'mobile',
use: { ...devices['Pixel 5'], viewport: { width: 390, height: 844 } },
},
],
webServer: {
command: isPreview
? 'npm run build && npm run preview -- --port 4321'
: 'npm run dev -- --port 4322',
port,
reuseExistingServer: !process.env.CI,
timeout: isPreview ? 60_000 : 30_000,
},
testIgnore: isScreenshots ? undefined : '**/screenshots.spec.ts',
...(isScreenshots && {
testMatch: 'screenshots.spec.ts',
}),
});