// apps/web/e2e/pages/health-data.page.ts import type { Page } from '@playwright/test'; export class HealthDataPage { readonly page: Page; constructor(page: Page) { this.page = page; } async clickAddVitalSigns() { await this.page.click('button:has-text("录入体征"), button:has-text("新增")'); await this.page.waitForSelector('.ant-modal, .ant-drawer', { timeout: 5000 }); } async fillVitalSignsForm(data: { systolic_bp?: number; diastolic_bp?: number; heart_rate?: number; temperature?: number; spo2?: number; }) { if (data.systolic_bp) await this.page.fill('#systolic_bp, input[placeholder*="收缩压"]', String(data.systolic_bp)); if (data.diastolic_bp) await this.page.fill('#diastolic_bp, input[placeholder*="舒张压"]', String(data.diastolic_bp)); if (data.heart_rate) await this.page.fill('#heart_rate, input[placeholder*="心率"]', String(data.heart_rate)); if (data.temperature) await this.page.fill('#temperature, input[placeholder*="体温"]', String(data.temperature)); if (data.spo2) await this.page.fill('#spo2, input[placeholder*="血氧"]', String(data.spo2)); } async submitVitalSigns() { await this.page.click('.ant-modal button[type="submit"], .ant-btn-primary'); await this.page.waitForSelector('.ant-message-success', { timeout: 10000 }); } async getVitalSignsList(): Promise { const rows = this.page.locator('.ant-table-tbody tr'); const count = await rows.count(); const texts: string[] = []; for (let i = 0; i < count; i++) { texts.push(await rows.nth(i).textContent() ?? ''); } return texts; } async trendChartIsVisible(): Promise { const chart = this.page.locator('canvas, .recharts-wrapper, [class*="chart"]'); return chart.isVisible(); } }