feat(mini_program): 小程序端从 Playwright 切换为 miniprogram-automator
驱动方式: 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
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/** 小程序 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 };
|
||||
Reference in New Issue
Block a user