-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplaywright.config.js
More file actions
37 lines (35 loc) · 1.33 KB
/
playwright.config.js
File metadata and controls
37 lines (35 loc) · 1.33 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
import { defineConfig, devices } from '@playwright/test'
const PORT = process.env.PORT ? Number(process.env.PORT) : 3100
const BASE_URL = `http://127.0.0.1:${PORT}`
// E2E runs against the production static export — same artifact the
// deploy uploads. `next build` writes to `out/`; `serve` then hosts it.
// Tests are thereby validating the actual deployed bundle, not the dev
// runtime, and CI doesn't need a long-running `next dev`.
export default defineConfig({
testDir: './tests/e2e',
timeout: 30_000,
expect: { timeout: 5_000 },
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list',
use: {
baseURL: BASE_URL,
trace: 'on-first-retry',
screenshot: 'only-on-failure'
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } }
],
webServer: {
command: `npm run build && npx serve out -p ${PORT} --no-clipboard`,
url: BASE_URL,
reuseExistingServer: !process.env.CI,
timeout: 240_000,
stdout: 'pipe',
stderr: 'pipe'
}
})