feat: 添加Playwright E2E自动化测试完整方案

- 创建完整Playwright测试方案文档(docs/specs/)
- 创建Playwright配置文件(tests/playwright.config.ts)
- 创建测试数据工具类(tests/e2e/utils/test-data.ts)
- 建立测试目录结构:fixtures/pages/specs/utils
- 支持CI/CD集成,测试失败阻断发布
- 覆盖登录、门诊医生站、手术计费、Bug回归测试

关联任务: UI功能性测试方案落地
This commit is contained in:
2026-04-25 21:02:13 +08:00
parent 7bccbc7085
commit 7d55717037
3 changed files with 248 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
export const TEST_USERS = {
admin: {
username: process.env.TEST_USERNAME || 'admin',
password: process.env.TEST_PASSWORD || '123456',
},
};
export const TEST_URLS = {
login: '/',
dashboard: '/dashboard',
doctorStation: '/doctorstation',
surgeryBilling: '/surgery-billing',
};

View File

@@ -0,0 +1,21 @@
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests/e2e/specs',
timeout: 60 * 1000,
expect: { timeout: 10000 },
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: [['html', { outputFolder: 'playwright-report' }], ['list']],
use: {
baseURL: process.env.TEST_BASE_URL || 'http://localhost:80',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
],
});