我的目标是在使用 Expo (turtle-cli) 构建的应用程序上使用 Appium 运行端到端测试。
我尝试使用以下参数启动 Appium-Desktop 测试 session :
{
"platformName": "android",
"deviceName": "ENU7N15B0300...",
"app": "path-to-apk",
"automationName": "UiAutomator2"
}
应用程序在智能手机上启动,但我从 Appium 收到超时错误:
[MJSONWP] Encountered internal error running command: Error: Cannot start the 'com.example.testetoeapplauda' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command 'adb -P 5037 -s ENU7N15B03007818 shell am start -W -n com.example.testetoeapplauda/host.exp.exponent.MainActivity -S' timed out after 20000ms'. Try to increase the 20000ms adb execution timeout represented by 'adbExecTimeout' capability
有趣的部分是 adb shell 命令。当我手动运行此命令时,应用程序启动,但命令没有完成 - 它只是永远挂起。
$ adb -P 5037 -s ENU7N15B03007818 shell am start -W -n com.example.testetoeapplauda/host.exp.exponent.MainActivity -S
Stopping: com.example.testetoeapplauda
Starting: Intent { cmp=com.example.testetoeapplauda/host.exp.exponent.MainActivity }
当我删除参数 -W
时,它不会阻塞。
您对如何在 Expo 应用程序上启动 Appium 测试有什么建议吗或者您是否知道如何更改 Appium 使其不使用 -W
旗帜?
这是 apk,如果你想测试它:expo-app-test apk file
最佳答案
从 appium 1.14.0 开始,可以选择跳过等待:
appWaitForLaunch: false
这将允许避免在 adb
命令上使用 -W 选项。
现在你必须安装 appium beta 版本,因为它还没有发布。
npm install -g appium@beta
关于android - Appium 未在 Android 上对 Expo App 启动测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57183060/