35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
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',
|
||
},
|
||
});
|