-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
50 lines (47 loc) · 1.36 KB
/
Copy pathplaywright.config.ts
File metadata and controls
50 lines (47 loc) · 1.36 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
import { defineConfig } from '@playwright/test'
import type { PlaywrightTestProject } from '@playwright/test'
const HOST = process.env.PLAYWRIGHT_HOST ?? '127.0.0.1'
const ESM_DEMO_PORT = Number(process.env.ESM_DEMO_PORT ?? 4173)
const LOADER_FIXTURE_PORT = Number(process.env.LOADER_FIXTURE_PORT ?? 4174)
const esmDemoUrl = process.env.ESM_DEMO_URL ?? `http://${HOST}:${ESM_DEMO_PORT}`
const projects: PlaywrightTestProject[] = [
{
name: 'chromium',
use: { browserName: 'chromium' },
},
]
if (process.env.CI) {
projects.push({
name: 'safari',
use: { browserName: 'webkit' },
})
}
export default defineConfig({
testDir: './playwright',
fullyParallel: true,
retries: process.env.CI ? 2 : 0,
reporter: process.env.CI ? 'github' : 'list',
expect: {
timeout: 10_000,
},
use: {
baseURL: esmDemoUrl,
trace: 'on-first-retry',
headless: true,
},
projects,
webServer: [
{
command: `npx serve . -l tcp://${HOST}:${ESM_DEMO_PORT}`,
url: `http://${HOST}:${ESM_DEMO_PORT}/test/fixtures/e2e.html`,
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
{
command: `npx serve test/fixtures/rspack-app -l tcp://${HOST}:${LOADER_FIXTURE_PORT}`,
url: `http://${HOST}:${LOADER_FIXTURE_PORT}/index.html`,
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
],
})