-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
103 lines (96 loc) · 3.54 KB
/
playwright.config.ts
File metadata and controls
103 lines (96 loc) · 3.54 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import { defineConfig, devices } from '@playwright/test'
let webServerCommand = 'pnpm turbo build --filter=@wangeditor-next/editor --filter=@wangeditor-next/plugin-markdown && pnpm --filter @wangeditor-next/demo-html run serve'
const reactDemoDevCommand = 'pnpm --filter @wangeditor-next/demo-react exec vite --host 127.0.0.1 --port 3102 --strictPort'
const vue3DemoDevCommand = 'pnpm --filter @wangeditor-next/demo-vue3 exec vite --force --host 127.0.0.1 --port 3103 --strictPort'
const reactDemoPreviewCommand = 'pnpm --filter @wangeditor-next/demo-react run build && pnpm --filter @wangeditor-next/demo-react exec vite preview --host 127.0.0.1 --port 3102 --strictPort'
const vue3DemoPreviewCommand = 'pnpm --filter @wangeditor-next/demo-vue3 run build && pnpm --filter @wangeditor-next/demo-vue3 exec vite preview --host 127.0.0.1 --port 3103 --strictPort'
let reactDemoCommand = reactDemoDevCommand
let vue3DemoCommand = vue3DemoDevCommand
if (process.env.PLAYWRIGHT_SKIP_BUILD) {
// CI e2e sets PLAYWRIGHT_SKIP_BUILD=1 and prebuilds only part of packages.
// Keep this lightweight but ensure plugin-markdown dist exists for markdown demos.
webServerCommand = 'pnpm turbo build --filter=@wangeditor-next/plugin-markdown && pnpm --filter @wangeditor-next/demo-html run serve'
} else if (process.env.CI) {
webServerCommand = 'pnpm turbo build --force --filter=@wangeditor-next/editor --filter=@wangeditor-next/plugin-markdown && pnpm --filter @wangeditor-next/demo-html run serve'
}
if (process.env.CI && process.env.PLAYWRIGHT_WRAPPER_PREVIEW === '1') {
reactDemoCommand = reactDemoPreviewCommand
vue3DemoCommand = vue3DemoPreviewCommand
}
export default defineConfig({
testDir: './tests/e2e',
timeout: 30_000,
expect: {
timeout: 5_000,
},
retries: process.env.CI ? 2 : 0,
use: {
baseURL: 'http://127.0.0.1:8881',
testIdAttribute: 'data-testid',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
webServer: [
{
command: webServerCommand,
url: 'http://127.0.0.1:8881/examples/default-mode.html',
reuseExistingServer: true,
stdout: 'inherit',
stderr: 'inherit',
timeout: 180_000,
},
{
command: reactDemoCommand,
url: 'http://127.0.0.1:3102',
reuseExistingServer: true,
stdout: 'inherit',
stderr: 'inherit',
timeout: process.env.CI ? 180_000 : 120_000,
},
{
command: vue3DemoCommand,
url: 'http://127.0.0.1:3103',
reuseExistingServer: true,
stdout: 'inherit',
stderr: 'inherit',
timeout: process.env.CI ? 180_000 : 120_000,
},
],
projects: (() => {
const projects: any[] = [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
testIgnore: ['**/*.smoke.spec.ts', '**/*.perf.spec.ts'],
},
]
if (process.env.PLAYWRIGHT_CROSS_BROWSER) {
projects.push(
{
name: 'chromium-smoke',
use: { ...devices['Desktop Chrome'] },
testMatch: '**/*.smoke.spec.ts',
},
{
name: 'firefox-smoke',
use: { ...devices['Desktop Firefox'] },
testMatch: '**/*.smoke.spec.ts',
},
{
name: 'webkit-smoke',
use: { ...devices['Desktop Safari'] },
testMatch: '**/*.smoke.spec.ts',
},
)
}
if (process.env.PLAYWRIGHT_INCLUDE_PERF) {
projects.push({
name: 'chromium-perf',
use: { ...devices['Desktop Chrome'] },
testMatch: '**/*.perf.spec.ts',
})
}
return projects
})(),
})