-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
56 lines (53 loc) · 1.56 KB
/
playwright.config.ts
File metadata and controls
56 lines (53 loc) · 1.56 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
50
51
52
53
54
55
56
import { defineConfig, devices } from '@playwright/test'
const mode = process.env.PLAYWRIGHT_MODE === 'pr' ? 'pr' : 'dev'
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? 'http://localhost:3000'
const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET
const authStatePath = `.playwright/.auth/${mode}-user.json`
const sharedUse = {
baseURL,
trace: 'retain-on-failure' as const,
screenshot: 'only-on-failure' as const,
video: 'on-first-retry' as const,
extraHTTPHeaders: bypassSecret
? { 'x-vercel-protection-bypass': bypassSecret }
: undefined,
}
export default defineConfig({
testDir: './tests/preview',
fullyParallel: true,
forbidOnly: Boolean(process.env.CI),
retries: process.env.CI ? 2 : 0,
reporter: [['list'], ['html', { open: 'never' }]],
outputDir: 'test-results',
use: sharedUse,
projects: [
{
name: `${mode}-public`,
testMatch: [`common/public/**/*.spec.ts`, `${mode}/**/*.spec.ts`],
testIgnore: ['**/authed/**'],
use: {
...devices['Desktop Chrome'],
...sharedUse,
},
},
{
name: `${mode}-auth-setup`,
testMatch: ['common/authed/auth.setup.ts'],
use: {
...devices['Desktop Chrome'],
...sharedUse,
},
},
{
name: `${mode}-authed`,
testMatch: ['common/authed/**/*.spec.ts', `${mode}/authed/**/*.spec.ts`],
testIgnore: ['**/auth.setup.ts'],
dependencies: [`${mode}-auth-setup`],
use: {
...devices['Desktop Chrome'],
...sharedUse,
storageState: authStatePath,
},
},
],
})