This commit is contained in:
2026-09-12 14:19:56 +08:00
commit 87ab0b794b
130 changed files with 30042 additions and 0 deletions

34
playwright.config.ts Normal file
View 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'] }
}
]
})