![2***@qq.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/629733a0d430ec73424c7ee8fe7611e4.png)
- 发布:2024-05-05 13:59
- 更新:2024-05-05 13:59
- 阅读:127
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: Windows 10 家庭中文版
HBuilderX类型: 正式
HBuilderX版本号: 4.14
手机系统: 全部
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
测试过的手机:
示例代码:
jest.config.js文件代码
module.exports = {
testTimeout: 10000,
reporters: [
'default'
],
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
moduleFileExtensions: ['js', 'json'],
rootDir: __dirname,
testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"],
testPathIgnorePatterns: ['/node_modules/'],
testEnvironmentOptions: {
compile: true,
"app-plus": { // 需要安装 HBuilderX
android: {
appid: "__UNI__AA3CE00", //自定义基座测试需配置manifest.json中的appid
package: "uni.UNIAA3CE00", //自定义基座测试需配置Android包名
executablePath: "E:\\Hello uni-app\\unpackage\\debug\\android_debug.apk" // apk 目录或自定义调试基座包路径
}
}
}
}
env.js文件代码
module.exports = {
"is-custom-runtime": false,
"compile": true,
"h5": {
"options": {
"headless": true
},
"executablePath": ""
},
"mp-weixin": {
"port": 9420,
"account": "",
"args": "",
"cwd": "",
"launch": true,
"teardown": "disconnect",
"remote": false,
"executablePath": ""
},
"app-plus": {
"android": {
"id": "192.168.10.5",
"executablePath": "E:\\HBuilderX\\HBuilderX\\plugins\\launcher\\base\\android_base.apk"
},
"version": "E:\\HBuilderX\\HBuilderX\\plugins\\launcher\\base\\version.txt",
"ios": {
"id": "",
"executablePath": ""
}
}
}
jest.config.js文件代码
module.exports = {
testTimeout: 10000,
reporters: [
'default'
],
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
moduleFileExtensions: ['js', 'json'],
rootDir: __dirname,
testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"],
testPathIgnorePatterns: ['/node_modules/'],
testEnvironmentOptions: {
compile: true,
"app-plus": { // 需要安装 HBuilderX
android: {
appid: "__UNI__AA3CE00", //自定义基座测试需配置manifest.json中的appid
package: "uni.UNIAA3CE00", //自定义基座测试需配置Android包名
executablePath: "E:\\Hello uni-app\\unpackage\\debug\\android_debug.apk" // apk 目录或自定义调试基座包路径
}
}
}
}
env.js文件代码
module.exports = {
"is-custom-runtime": false,
"compile": true,
"h5": {
"options": {
"headless": true
},
"executablePath": ""
},
"mp-weixin": {
"port": 9420,
"account": "",
"args": "",
"cwd": "",
"launch": true,
"teardown": "disconnect",
"remote": false,
"executablePath": ""
},
"app-plus": {
"android": {
"id": "192.168.10.5",
"executablePath": "E:\\HBuilderX\\HBuilderX\\plugins\\launcher\\base\\android_base.apk"
},
"version": "E:\\HBuilderX\\HBuilderX\\plugins\\launcher\\base\\version.txt",
"ios": {
"id": "",
"executablePath": ""
}
}
}
操作步骤:
下载Hello uniapp模版,打包自定义基座,修改jest.config.js的appid、package、executablePath三个属性,运行自动化插件到android
下载Hello uniapp模版,打包自定义基座,修改jest.config.js的appid、package、executablePath三个属性,运行自动化插件到android
预期结果:
使用自定义基座进行自动化测试
使用自定义基座进行自动化测试
实际结果:
使用默认基座进行自动化测试
使用默认基座进行自动化测试
bug描述:
按文档配置jest.config.js的appid、package、executablePath三个属性后依旧不会启动自定义基座进行自动化测试。在Hello uni-app中依旧有此问题
0 个回复