testwa-desktop
预编译安装包环境依赖
脚本回放依赖安装
pip install pytest allure-pytest Appium-Python-Client
开发环境依赖
- Node.js
- Git
开发
- git clone https://github.com/tanghongxin/testwa-gen.git
- npm install / cnpm install / yarn install
- cd static
- git clone https://github.com/tanghongxin/wappium.git
- npm i (必须使用 npm)
- npm run dev / cnpm run dev / yarn dev
打包
- 绿色版:npm run build:dir / cnpm run build:dir / yarn build:dir
- 安装版:npm run build:pack / cnpm run build:pack / yarn build:pack
常用命令
- 重启 adb:
adb kill-server && adb start-server
- not a valid zip file 错误:
rm -rf ~/Library/Caches/electron
- 还原 device: npm run clean / cnpm run clean / yarn clean
目录结构
- src
- api ---- 全局接口
- common ---- 全局配置
- main ---- electron 主进程代码
- renderer ---- react 渲染进程代码(已启用 node 集成)
- utils ---- 工具目录
- .release-it.js ---- erelease-it 配置文件
- electron-build-yml ---- electron-build 配置文件
- jsconfig.json vscode ---- 智能提示配置文件
FAQ
- 首页图片不显示:修改 node_modules/af-webpack/lib/getConfig.js 的 url-loader options limit: 10000000
- 生产环境下 can not find module:检查 electron-builder.yml 部分是否将 target 文件打包进去
- 安装依赖或打包比较耗时,属正常现象
TODO
- 支持设备弹出时还原到最初状态
- 过多回调函数,用 Promise 重写
- 过多使用 setInterval + setTimeout 的容错处理与状态更新
- 部分依赖已过期(如 request),升级或选用替代品
- 数据流向较为凌乱,可以尝试使用 rxjs 处理事件流
- electron 热更新与 webpack 配置
- 考虑将 minicap、minitouch 包迁移到 static 目录下,尽量不直接操作 node_modules 目录
- Release 命令
- Minicap、minitouch 从渲染进程中拆分,使用多进程提升效率
- 引入装饰器,放弃 redux 传统 connect(xxx)(component) 的编码方式,优化代码可读性
- react 老版本代码更新,使用新特性,如 hooks
In Progress
- 安卓 10 Scrcpy 适配
- 支持按坐标点击元素
BUG
- 多设备连接时,设备间切换可能存在内存泄漏(未处理当前进行中的子进程)
- appium 与 adb keyboard 偶尔出现连接不上
- 回放过程中,连续执行两次 await sleep 会导致回放进程退出(可能与 electron 提供的 node 环境与事件轮训机制有关)
- Windows 10 高分屏下样式有异常