Files
hms/apps/web/e2e/tenant-isolation.spec.ts
iven c53f5625bc
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled
fix(web,miniprogram): 端到端测试修复 + 小程序接口字段对齐
## 前端修复
- 修复 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 工具函数
2026-04-27 22:09:21 +08:00

40 lines
1.5 KiB
TypeScript

import { test, expect } from './auth.fixture';
test.describe('多租户隔离', () => {
test('侧边栏按模块分组显示', async ({ page }) => {
await page.goto('/#/');
await page.waitForLoadState('networkidle');
// 验证侧边栏模块分组
await expect(page.locator('text=基础模块').first()).toBeVisible({ timeout: 10000 });
await expect(page.locator('text=业务模块').first()).toBeVisible();
await expect(page.locator('text=系统').first()).toBeVisible();
// 验证关键菜单项
await expect(page.locator('text=工作台').first()).toBeVisible();
await expect(page.locator('text=用户管理').first()).toBeVisible();
});
test('顶部导航栏显示用户信息', async ({ page }) => {
await page.goto('/#/');
await page.waitForLoadState('networkidle');
// 验证顶部导航栏显示管理员信息
await expect(page.locator('text=系统管理员').first()).toBeVisible({ timeout: 10000 });
});
test('页面间导航正常工作', async ({ page }) => {
await page.goto('/#/');
await page.waitForLoadState('networkidle');
// 点击侧边栏的用户管理(精确匹配侧边栏区域)
const sidebar = page.locator('complementary, [class*=sider], [class*=menu], nav').first();
await sidebar.locator('text=用户管理').first().click();
await expect(page).toHaveURL(/#\/users/, { timeout: 10000 });
// 点击工作台返回
await sidebar.locator('text=工作台').first().click();
await expect(page).toHaveURL(/#\/$/, { timeout: 10000 });
});
});