build-flow.admin/playwright.config.ts
向宁 77aac58f22
Some checks failed
CI / lint (push) Has been cancelled
CI / build (20, macOS-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
test: add playwright e2e suites for create-forms and obsidian-sync
2026-10-25 16:27:43 +08:00

35 lines
1.1 KiB
TypeScript
Raw 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';
/**
* BuildFlow React 管理端 E2E 配置。
*
* 默认跑 UI 级端到端(page.route 拦截 /api/**,确定性、无外部依赖);
* 启动 dev server(umi max,端口 8000)由 webServer 自动托管,测试结束自动关闭。
*/
export default defineConfig({
testDir: './e2e',
timeout: 60_000,
expect: { timeout: 15_000 },
fullyParallel: false,
workers: 1,
retries: 0,
reporter: [['list']],
use: {
baseURL: 'http://localhost:8000',
headless: true,
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
webServer: {
// 用生产构建 + max preview:dev server 按需 bundling 会导致页面长时间停在
// "Bundling..." 中间页、CSS 未注入等不稳定状态,E2E 必须确定性环境。
command: 'npx max preview --port 8000',
url: 'http://localhost:8000',
reuseExistingServer: !process.env.CI,
timeout: 60_000,
stdout: 'ignore',
stderr: 'pipe',
},
});