library-picturebook-activity/lesingle-creation-frontend/playwright.config.ts
En 98e9ad1d28 feat(前端): 测试环境登录框支持自动填充测试账号
通过 VITE_AUTO_FILL_TEST 环境变量控制,在 .env.test 中启用,
使测试环境构建后登录框也能自动填充测试账号,方便测试人员使用。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 17:03:22 +08:00

42 lines
914 B
TypeScript

import { defineConfig, devices } from '@playwright/test'
/**
* Playwright E2E 测试配置
* 乐读派 AI 绘本创作集成测试
*/
export default defineConfig({
testDir: './e2e',
/* 测试超时 */
timeout: 30_000,
expect: {
timeout: 10_000,
},
/* 并行执行 */
fullyParallel: true,
/* CI 环境重试 */
retries: process.env.CI ? 2 : 0,
/* 报告 */
reporter: [['html', { open: 'never' }], ['list']],
/* 全局配置 */
use: {
baseURL: process.env.FRONTEND_URL || 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
actionTimeout: 10_000,
},
/* 浏览器项目 */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
/* 本地开发服务器 */
webServer: {
command: 'npm run dev',
port: 3000,
reuseExistingServer: !process.env.CI,
timeout: 30_000,
},
})