// apps/miniprogram/e2e/helpers/auth.helper.ts import { AutomatorClient } from './automator-client'; import { MpApiClient } from './api-client'; export class MpAuthHelper { constructor( private client: AutomatorClient, private api: MpApiClient, ) {} async loginAsTestPatient() { const loginRes = await this.api.login( process.env.E2E_MP_USER || 'mp_e2e_test', process.env.E2E_MP_PASS || 'Test@2026', ); await this.client.reLaunch('/pages/index/index'); const page = await this.client.currentPage(); await this.client.callMethod('page', 'setData', { 'access_token': loginRes.access_token, }); await this.client.reLaunch('pages/index/index'); } }