/** 小程序 Page Object(Node 版)— 首页 */ class HomePage { constructor(miniProgram) { this.mp = miniProgram; } async goToOrderList() { const page = await this.mp.currentPage(); const el = await page.$(".order-entry, .order-item"); if (el) await el.tap(); await this.mp.waitFor(1000); } async goToMine() { const page = await this.mp.currentPage(); const el = await page.$(".mine-tab, .my-entry"); if (el) await el.tap(); await this.mp.waitFor(1000); } async screenshot(name) { const path = require("path"); const file = path.resolve(__dirname, `../../../../output/screenshots/mini_program/${name}_${Date.now()}.png`); await this.mp.screenshot({ path: file }); return file; } } module.exports = { HomePage };