## 前端修复 - 修复 9 个 TypeScript 编译错误(未使用变量/undefined 守卫/vitest 类型) - 重写 E2E auth fixture 使用真实 API 登录替代 mock token - 更新 E2E 测试选择器适配当前 UI 布局 - Playwright 改为串行执行避免 token 唯一约束冲突 - E2E 测试从 0/10 通过提升到 10/10 通过 ## 小程序接口一致性修复(P0-P3) - P0: consultation.ts type→consultation_type, unread_count→unread_count_patient - P0: followup.ts task_type→follow_up_type, due_date→planned_date, description→content_template - P1: appointment.ts calendarView 展平嵌套结构, available_count 计算 max-current - P1: doctor.ts HealthSummary 适配后台实际返回结构 - P2: doctor.ts PatientStats/ConsultationStats/FollowUpStats 字段名对齐 - P3: article.ts 新增 buildCategoryTree 工具函数
49 lines
2.0 KiB
TypeScript
49 lines
2.0 KiB
TypeScript
import { test, expect } from './auth.fixture';
|
|
|
|
test.describe('用户管理', () => {
|
|
test('用户列表页面加载并显示表格', async ({ page }) => {
|
|
await page.goto('/#/');
|
|
// 通过侧边栏导航到用户管理
|
|
await page.locator('text=用户管理').first().click();
|
|
await expect(page).toHaveURL(/#\/users/, { timeout: 10000 });
|
|
|
|
// 标题
|
|
await expect(page.locator('h4')).toContainText('用户管理');
|
|
// 新建用户按钮
|
|
await expect(page.locator('button:has-text("新建用户")')).toBeVisible();
|
|
// 搜索框
|
|
await expect(page.locator('input[placeholder*="搜索"]')).toBeVisible();
|
|
// 表格列头
|
|
await expect(page.locator('text=用户').first()).toBeVisible();
|
|
await expect(page.locator('text=状态').first()).toBeVisible();
|
|
});
|
|
|
|
test('新建用户弹窗表单验证', async ({ page }) => {
|
|
await page.goto('/#/');
|
|
await page.locator('text=用户管理').first().click();
|
|
await expect(page).toHaveURL(/#\/users/, { timeout: 10000 });
|
|
|
|
// 点击新建
|
|
await page.click('button:has-text("新建用户")');
|
|
// 弹窗出现
|
|
await expect(page.locator('.ant-modal')).toBeVisible();
|
|
// 直接提交应显示验证错误(点击 modal 内最后一个 button 即确认按钮)
|
|
const modalButtons = page.locator('.ant-modal .ant-modal-footer button');
|
|
await modalButtons.last().click();
|
|
// Ant Design 应显示验证错误(用户名 + 密码必填)
|
|
await expect(page.locator('.ant-form-item-explain-error')).toHaveCount(2);
|
|
// 关闭弹窗(点击第一个按钮即取消)
|
|
await modalButtons.first().click();
|
|
});
|
|
|
|
test('搜索框可输入', async ({ page }) => {
|
|
await page.goto('/#/');
|
|
await page.locator('text=用户管理').first().click();
|
|
await expect(page).toHaveURL(/#\/users/, { timeout: 10000 });
|
|
|
|
const searchInput = page.locator('input[placeholder*="搜索"]');
|
|
await searchInput.fill('admin');
|
|
await expect(searchInput).toHaveValue('admin');
|
|
});
|
|
});
|