// apps/web/e2e/flows/vital-signs-flow.spec.ts import { test, expect } from '../fixtures/auth.fixture'; import { PatientDetailPage } from '../pages/patient-detail.page'; import { HealthDataPage } from '../pages/health-data.page'; import { makePatient, makeVitalSigns } from '../fixtures/test-data'; test.describe('@flow 体征数据链路', () => { const cleanup: Array<() => Promise> = []; test.afterEach(async () => { for (const fn of cleanup.reverse()) { await fn().catch(() => {}); } cleanup.length = 0; }); test('录入体征 → 查看列表 → 查看趋势', async ({ api, authenticatedPage: page }) => { const patient = await api.createPatient(makePatient()); cleanup.push(() => api.deletePatient(patient.id, patient.version)); const detailPage = new PatientDetailPage(page); await detailPage.goto(patient.id); await detailPage.clickTab('体征'); const healthPage = new HealthDataPage(page); await healthPage.clickAddVitalSigns(); await healthPage.fillVitalSignsForm({ systolic_bp: 125, diastolic_bp: 82, heart_rate: 75, }); await healthPage.submitVitalSigns(); const list = await healthPage.getVitalSignsList(); expect(list.length).toBeGreaterThanOrEqual(1); const vitalSigns = await api.createVitalSigns(patient.id, makeVitalSigns({ systolic_bp: 130, heart_rate: 80, })); cleanup.push(() => api.deleteVitalSigns(patient.id, vitalSigns.id, vitalSigns.version)); await page.reload(); await page.waitForSelector('.ant-table'); const updatedList = await healthPage.getVitalSignsList(); expect(updatedList.length).toBeGreaterThanOrEqual(1); }); });