// apps/miniprogram/e2e/flows/vital-signs-input.spec.ts import { describe, it, expect, beforeAll, afterAll, afterEach } from 'vitest'; import { AutomatorClient } from '../helpers/automator-client'; import { MpAuthHelper } from '../helpers/auth.helper'; import { MpApiClient } from '../helpers/api-client'; import { MpNavigator } from '../helpers/navigation.helper'; describe('体征数据录入链路', () => { let client: AutomatorClient; let auth: MpAuthHelper; let nav: MpNavigator; let api: MpApiClient; const cleanup: Array<() => Promise> = []; beforeAll(async () => { api = new MpApiClient(); await api.login(); client = new AutomatorClient(); await client.connect(); auth = new MpAuthHelper(client, api); nav = new MpNavigator(client); await auth.loginAsTestPatient(); }, 30_000); afterEach(async () => { for (const fn of cleanup.reverse()) await fn().catch(() => {}); cleanup.length = 0; }); afterAll(async () => { await client.disconnect(); }); it('填写并提交血压心率数据', async () => { await nav.goToVitalSignsInput(); await client.inputText('input[placeholder*="收缩压"], #systolic', '118'); await client.inputText('input[placeholder*="舒张压"], #diastolic', '76'); await client.inputText('input[placeholder*="心率"], #heartRate', '68'); await client.tap('button[type="submit"], .submit-btn'); const el = await client.waitForElement('.success, .ant-message-success, [class*="toast"]', 5000).catch(() => null); const pageData = await client.getPageData(); expect(pageData).toBeDefined(); }); });