b822428a2a
驱动方式: Python pytest → subprocess → node runner.js → miniprogram-automator → 微信开发者工具 架构: tests/web/mini_program/automator/ (Node.js) + conftest.py (Python subprocess 桥接) 前置条件: 微信开发者工具 + 开启服务端口 + npm install + uni-app build:mp-weixin
31 lines
791 B
JavaScript
31 lines
791 B
JavaScript
/** 小程序 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 };
|