2***@qq.com
2***@qq.com
  • 发布:2024-05-04 02:50
  • 更新:2024-05-05 00:22
  • 阅读:165

配置jest.config.js后,自动化测试依然无法使用android自定义基座进行测试

分类:uni-app
const path = require("path")  
module.exports = {  
    testTimeout: 10000,  
    reporters: [  
        'default'  
    ],  
    watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],  
    moduleFileExtensions: ['js', 'json'],  
    rootDir: __dirname,  
    testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)","<rootDir>/*pack/**/*test.[jt]s?(x)"],  
    testPathIgnorePatterns: ['/node_modules/'],  
    testEnvironmentOptions: {  
        compile: true,  
        "app-plus": { // 需要安装 HBuilderX  
            android: {  
                appid: "__UNI__A4BB50E", //自定义基座测试需配置manifest.json中的appid  
                package: "io.biquge", //自定义基座测试需配置Android包名  
                executablePath: path.join(__dirname,"unpackage/debug/android_debug.apk")   // apk 目录或自定义调试基座包路径  
            }  
        }  

    }  
}

到底哪里错了

2024-05-04 02:50 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com (作者)

解决办法一:
直接不修改jest.config.js了,转而修改env.js的is-custom-runtime字段和app-plus.android.executablePath字段,
is-custom-runtime字段值为true,app-plus.android.executablePath字段值为自定义基座路径

module.exports = {  
    "is-custom-runtime": true,  
    "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:\\book\\unpackage\\debug\\android_debug.apk"  
        },  
        "version": "E:\\HBuilderX\\HBuilderX\\plugins\\launcher\\base\\version.txt",  
        "ios": {  
            "id": "",  
            "executablePath": ""  
        }  
    }  
}
  • 2***@qq.com (作者)

    方法一是错误的,解决失败

    2024-05-05 14:40

要回复问题请先登录注册