-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
51 lines (46 loc) · 1.35 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
49
50
51
import path from 'node:path'
import { defineConfig, devices } from '@playwright/test'
import dotenv from 'dotenv'
const PLAYWRIGHT_TEST_TIMEOUT_SECONDS = 120
const PLAYWRIGHT_EXPECT_TIMEOUT_SECONDS = 10
const PLAYWRIGHT_RETRIES = 3
const currentScriptFolder = new URL(import.meta.url).pathname
dotenv.config({ path: path.resolve(currentScriptFolder, '.env') })
const environment = process.env.NEXT_PUBLIC_NODE_ENV ?? 'development'
export default defineConfig({
expect: {
timeout: PLAYWRIGHT_EXPECT_TIMEOUT_SECONDS * 1000
},
forbidOnly: environment !== 'development',
fullyParallel: true,
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
},
],
reporter: 'html',
retries: environment !== 'development' ? PLAYWRIGHT_RETRIES : 0,
testDir: './src/',
testMatch: '**/*.e2e.ts',
timeout: PLAYWRIGHT_TEST_TIMEOUT_SECONDS * 1000,
use: {
baseURL: process.env.PLAYWRIGHT_BASE_URL ?? 'http://localhost:3000',
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
video: 'retain-on-failure',
},
workers: environment !== 'development' ? 1 : undefined,
})