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:
xst
2026-07-15 17:34:25 +08:00
parent 03e152baab
commit b822428a2a
9 changed files with 393 additions and 112 deletions
+14 -16
View File
@@ -28,24 +28,22 @@ admin:
storage_state_dir: "tests/web/auth"
# ═══════════════════════════════════════════════════════════════════
# ── 司机端小程序 (Web/Playwright,模拟微信 WebView) ──
# ── 司机端小程序 (miniprogram-automator / Node.js) ──
# ═══════════════════════════════════════════════════════════════════
# 原理: Python pytest → subprocess → node runner.js → miniprogram-automator
# 操控微信开发者工具中的小程序,返回 JSON 结果
#
# 前置条件:
# 1. 安装微信开发者工具 + 开启服务端口(设置 → 安全 → 服务端口)
# 2. uni-app 编译为微信小程序: npm run build:mp-weixin
# 3. 安装依赖: cd tests/web/mini_program/automator && npm install
mini_program:
base_url: "https://ybxcx.ynyun8.com:8000/mini" # ⚠️ 请确认小程序 WebView 实际地址
# uni-app 编译出的小程序项目路径(.js/.json/.wxml 所在目录)
project_path: "E:/test/QaAutomationHub/mini_program/dist" # ⚠️ 请确认实际路径
# 微信开发者工具 CLI 路径(Windows 默认如下,macOS 为 /Applications/...
dev_tool_path: "C:/Program Files (x86)/Tencent/微信web开发者工具/cli.bat"
timeout_seconds: 120
screenshot_on_failure: true
screenshot_on_step: false
browsers:
- chromium
# 模拟微信内置浏览器 UA
user_agent: "Mozilla/5.0 MicroMessenger/8.0.0"
viewport:
width: 375
height: 812
# 小程序本质是 WebView,同样支持 storage_state 复用
skip_login: true
storage_state_dir: "tests/web/auth"
# ═══════════════════════════════════════════════════════════════════
# ── 司机安卓端 (App/Appium) ──
@@ -74,8 +72,8 @@ shipper_android:
skip_login: true
device_name: "Android Emulator"
app_package: "com.yunba.shipper" # ⚠️ 请确认实际包名
app_activity: ".MainActivity" # ⚠️ 请确认实际启动 Activity
app_package: "com.arpa.ynChengGangShipper" # ⚠️ 请确认实际包名
app_activity: "com.arpa.wuche_shipper.MainActivity" # ⚠️ 请确认实际启动 Activity
no_reset: true
new_command_timeout: 120