-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaywright.config.ts
48 lines (47 loc) · 1.33 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
41
42
43
44
45
46
47
48
import { defineConfig, devices } from '@playwright/test'
export default defineConfig({
testDir: './tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: 'html',
use: {
baseURL: 'http://localhost:4321',
trace: 'on-first-retry'
},
projects: ['dark', 'light'].flatMap((colorScheme) => [
// PC
...[
{ name: 'Desktop Chrome', device: 'Desktop Chrome' },
{ name: 'Desktop Safari', device: 'Desktop Safari' }
].flatMap(({ name, device }) =>
[640, 768, 1024, 1280, 1536].flatMap((width) => ({
name: `${name}/W${width}px/${colorScheme}`,
use: { ...devices[device], viewport: { width, height: 1080 } },
colorScheme
}))
),
// Mobile
...[
{ name: 'Mobile Chrome', device: 'Pixel 7' },
{ name: 'Mobile Safari', device: 'iPhone 13 Mini' }
].flatMap(({ name, device }) => [
{
name: `${name}/Portrait/${colorScheme}`,
use: devices[device],
colorScheme
},
{
name: `${name}/Landscape/${colorScheme}`,
use: devices[`${device} landscape`],
colorScheme
}
])
]),
webServer: {
command: 'npm run build && npm run preview',
url: 'http://localhost:4321',
reuseExistingServer: false
}
})