update
This commit is contained in:
34
playwright.config.ts
Normal file
34
playwright.config.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { defineConfig, devices } from '@playwright/test'
|
||||
|
||||
/**
|
||||
* Playwright 配置。
|
||||
*
|
||||
* 几个值得说明的选择:
|
||||
* - fullyParallel: false + workers: 1:每个测试启动一个完整 Electron 实例,几百兆内存。
|
||||
* 真机 CI 上多 worker 容易 OOM 也不见得更快。
|
||||
* - reporter: [['list'], ['html', { open: 'never' }]]:list 走 stdout 让人看,html
|
||||
* 写 report/ 让人事后翻(CI 上传 artifact 用)。
|
||||
* - timeout: 90s:引擎跑 Python 最坏 timeout 30s + 启动开销;hot path 单测。
|
||||
* - use.expect.timeout: 10s:默认 expect 超时。但有 call graph worker 那种「真的
|
||||
* 要算 5 秒」的断言会自己覆盖成 30s。
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
timeout: 90_000,
|
||||
fullyParallel: false,
|
||||
workers: 1,
|
||||
reporter: [['list'], ['html', { outputFolder: 'playwright-report', open: 'never' }]],
|
||||
use: {
|
||||
trace: 'retain-on-failure',
|
||||
screenshot: 'only-on-failure',
|
||||
video: 'retain-on-failure'
|
||||
// expect 超时不在顶层设(@playwright/test v1.46 不支持);
|
||||
// 各处按需在 expect().toBeVisible({ timeout: ... }) 里指定
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'electron',
|
||||
use: { ...devices['Desktop Chrome'] }
|
||||
}
|
||||
]
|
||||
})
|
||||
Reference in New Issue
Block a user