// apps/miniprogram/e2e/flows/mall-flow.spec.ts import { describe, it, expect, beforeAll, afterAll } 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; beforeAll(async () => { const api = new MpApiClient(); client = new AutomatorClient(); await client.connect(); auth = new MpAuthHelper(client, api); nav = new MpNavigator(client); await auth.loginAsTestPatient(); }, 30_000); afterAll(async () => { await client.disconnect(); }); it('商城首页加载', async () => { await nav.goToMall(); const el = await client.waitForElement('.container', 5000); expect(el).toBeDefined(); }); it('浏览商品分类', async () => { const tabs = await client.getElements('.tab-item, .category-item, .ant-tabs-tab'); if (tabs.length > 1) { await tabs[1].tap(); await new Promise((r) => setTimeout(r, 1000)); } const pageData = await client.getPageData(); expect(pageData).toBeDefined(); }); });