-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplaywright.config.ts
37 lines (32 loc) · 961 Bytes
/
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
import type { PlaywrightTestConfig } from '@playwright/test'
// Run local tests headed: PUBLIC_ENV=development npm run test -- --headed
const isLocalTest = process.env.PUBLIC_ENV === 'development'
// Runs in local webserver
const config: PlaywrightTestConfig = {
use: {
contextOptions: {
permissions: ['clipboard-read', 'clipboard-write']
},
video: 'off',
screenshot: 'only-on-failure'
},
webServer: {
command: 'VERCEL_URL=http://localhost:4173 npm run build && npm run preview',
port: 4173
},
testDir: 'tests/local'
}
// Runs on published websites
const configPublished: PlaywrightTestConfig = {
timeout: 10000,
use: {
contextOptions: {
permissions: ['clipboard-read', 'clipboard-write']
},
video: 'off',
screenshot: 'only-on-failure',
baseURL: process.env.VERCEL_URL || 'http://localhost:3000'
},
testDir: 'tests/published'
}
export default isLocalTest ? config : configPublished