Files
crm_project/frontend/playwright.config.ts
hankin 815cbf9d8c v0.2.0: CRM/ERP 系统升级 - 清理 .gitignore 并移除误提交的 venv/env/db 文件
- 更新 .gitignore:全面覆盖环境变量、数据库、日志、缓存、上传文件
- 移除误跟踪的 server/venv/、crm_data.db、.env 文件
- 新增 server/.env.example 模板
- 新增合同管理、利润核算、AI教练等功能模块
- 新增 Playwright e2e 测试套件
- 前后端多项功能升级和 bug 修复
2026-05-11 07:24:19 +00:00

69 lines
1.7 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';
/**
* SHBL-ERP CRM Playwright E2E 配置
*
* 运行方式:
* npx playwright test # 全量
* npx playwright test --headed # 有头模式
* npx playwright test --ui # UI 模式
* npx playwright test tests/login.spec.ts # 单文件
*
* 前置:
* 1. 确保后端 uvicorn 已启动 (http://localhost:8000)
* 2. 确保前端 vite dev 已启动 (http://localhost:5173)
* 3. 数据库已有可用的管理员账号 (admin / admin123)
*/
export default defineConfig({
testDir: './e2e',
fullyParallel: false, // CRM 测试有数据依赖,串行执行
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: 1,
reporter: [
['list'],
['html', { open: 'never' }],
],
use: {
baseURL: 'http://localhost:80',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
// 中文字体 viewport
locale: 'zh-CN',
timezoneId: 'Asia/Shanghai',
viewport: { width: 1440, height: 900 },
},
projects: [
// ── 先执行全局登录,保存认证状态 ──
{ name: 'setup', testMatch: /.*\.setup\.ts/ },
// ── 主测试套件 ──
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
storageState: './e2e/.auth/user.json',
},
dependencies: ['setup'],
},
],
/* 注释掉可选的自动启动 dev servers
webServer: [
{
command: 'cd ../server && venv/bin/uvicorn app.main:app --host 0.0.0.0 --port 8000',
port: 8000,
reuseExistingServer: true,
},
{
command: 'npm run dev',
port: 5173,
reuseExistingServer: true,
},
],
*/
});