Web 端 (Playwright): - fixtures: test-data 工厂 + API Client (乐观锁 version) + 增强 auth fixture - pages: LoginPage, PatientListPage, PatientDetailPage, HealthDataPage, AppointmentPage - flows: 患者全流程, 体征数据链路, 预约排班链路, 随访管理链路, 告警处理链路 - smoke tests 迁移到 smoke/ 目录,import 路径更新 - playwright.config.ts 更新: globalSetup 环境检查, 60s timeout, video retain 小程序端 (Vitest + miniprogram-automator): - helpers: AutomatorClient, MpApiClient, MpAuthHelper, MpNavigator - flows: 患者健康数据查看, 体征数据录入, 积分签到兑换, 积分商城浏览 - vitest.config.ts + check-readiness.ts - vitest 4.1.5 依赖安装 Playwright 发现 15 个测试 (5 flow + 10 smoke),全部就绪
57 lines
2.0 KiB
TypeScript
57 lines
2.0 KiB
TypeScript
// apps/web/e2e/pages/appointment.page.ts
|
|
import type { Page } from '@playwright/test';
|
|
|
|
export class AppointmentPage {
|
|
readonly page: Page;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
}
|
|
|
|
async gotoSchedule() {
|
|
await this.page.goto('/#/health/schedules');
|
|
await this.page.waitForSelector('.ant-table, .ant-fullcalendar, [class*="calendar"]', { timeout: 10000 });
|
|
}
|
|
|
|
async gotoAppointments() {
|
|
await this.page.goto('/#/health/appointments');
|
|
await this.page.waitForSelector('.ant-table', { timeout: 10000 });
|
|
}
|
|
|
|
async clickCreateSchedule() {
|
|
await this.page.click('button:has-text("新增排班"), button:has-text("创建")');
|
|
await this.page.waitForSelector('.ant-modal, .ant-drawer', { timeout: 5000 });
|
|
}
|
|
|
|
async fillScheduleForm(data: { doctor_id?: string; date: string; start_time: string; end_time: string }) {
|
|
if (data.doctor_id) {
|
|
await this.page.click('.ant-select');
|
|
await this.page.click('.ant-select-item-option');
|
|
}
|
|
await this.page.fill('input[placeholder*="日期"]', data.date);
|
|
await this.page.fill('input[placeholder*="开始"]', data.start_time);
|
|
await this.page.fill('input[placeholder*="结束"]', data.end_time);
|
|
}
|
|
|
|
async submitScheduleForm() {
|
|
await this.page.click('.ant-modal button[type="submit"], .ant-btn-primary');
|
|
await this.page.waitForSelector('.ant-message-success', { timeout: 10000 });
|
|
}
|
|
|
|
async clickCreateAppointment() {
|
|
await this.page.click('button:has-text("新增预约"), button:has-text("创建")');
|
|
await this.page.waitForSelector('.ant-modal, .ant-drawer', { timeout: 5000 });
|
|
}
|
|
|
|
async fillAppointmentForm(data: { patient_id: string; doctor_id: string; date: string; reason?: string }) {
|
|
if (data.reason) {
|
|
await this.page.fill('textarea, input[placeholder*="原因"]', data.reason);
|
|
}
|
|
}
|
|
|
|
async submitAppointmentForm() {
|
|
await this.page.click('.ant-modal button[type="submit"], .ant-btn-primary');
|
|
await this.page.waitForSelector('.ant-message-success', { timeout: 10000 });
|
|
}
|
|
}
|