Files
Python-Profiler-Visualizer/playwright.config.ts
2026-09-12 14:19:56 +08:00

35 lines
1.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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'] }
}
]
})