执行 Detox 测试命令后出现 DetoxRuntimeError
Posted
技术标签:
【中文标题】执行 Detox 测试命令后出现 DetoxRuntimeError【英文标题】:DetoxRuntimeError after executing the Detox test command 【发布时间】:2020-03-23 05:04:09 【问题描述】:
Detox test -c android.emu.debug
此问题报告它没有找到设备。但是设备已连接并且被系统识别。请对此提供任何帮助。
请找到 package.json 文件
“排毒”: “配置”: “android.emu.debug”: "binaryPath": "android/app/build/outputs/apk/staging/debug/app-debug.apk", "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..", “类型”:“android.attached”, “设备”: “avdName”:“56149225” , “android.emu.release”: "binaryPath": "android/app/build/outputs/apk/release/app-release.apk", "build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..", “类型”:“android.emulator”, “设备”: “avdName”:“56149225”
日志
detox[16824] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR]
DetoxRuntimeError: DetoxRuntimeError: Could not find 'undefined' on the currently ADB attached devices:
HINT: Make sure your device is connected.
You can also try restarting adb with 'adb kill-server && adb start-server'.
List of devices attached
56149225 device
at AttachedAndroidDriver.acquireFreeDevice (/home/yajana/Documents/Detox/examples/mobile-client/node_modules/detox/src/devices/drivers/AttachedAndroidDriver.js:21:13)
at async Device.prepare (/home/yajana/Documents/Detox/examples/mobile-client/node_modules/detox/src/devices/Device.js:20:22)
at async Detox.init (/home/yajana/Documents/Detox/examples/mobile-client/node_modules/detox/src/Detox.js:72:5)
at async Function._initializeInstance (/home/yajana/Documents/Detox/examples/mobile-client/node_modules/detox/src/DetoxExportWrapper.js:81:7)
at async DetoxExportWrapper.init (/home/yajana/Documents/Detox/examples/mobile-client/node_modules/detox/src/DetoxExportWrapper.js:32:20)
at async Context.<anonymous> (/home/yajana/Documents/Detox/examples/mobile-client/e2e/init.js:6:3)
1) "before all" hook in "root"
0 passing (39ms)
1 failing
1) "before all" hook in "root":
Error: DetoxRuntimeError: Could not find 'undefined' on the currently ADB attached devices:
HINT: Make sure your device is connected.
You can also try restarting adb with 'adb kill-server && adb start-server'.
List of devices attached
56149225 device
at AttachedAndroidDriver.acquireFreeDevice (node_modules/detox/src/devices/drivers/AttachedAndroidDriver.js:21:13)
at async Device.prepare (node_modules/detox/src/devices/Device.js:20:22)
at async Detox.init (node_modules/detox/src/Detox.js:72:5)
at async Function._initializeInstance (node_modules/detox/src/DetoxExportWrapper.js:81:7)
at async DetoxExportWrapper.init (node_modules/detox/src/DetoxExportWrapper.js:32:20)
at async Context.<anonymous> (e2e/init.js:6:3)
detox[16816] ERROR: [cli.js] Error: Command failed: node_modules/.bin/mocha --opts e2e/mocha.opts --configuration android.emu.debug --grep :ios: --invert "e2e"
【问题讨论】:
【参考方案1】:试试"adbName" : <your-device-name>
而不是"avdName"
。
【讨论】:
以上是关于执行 Detox 测试命令后出现 DetoxRuntimeError的主要内容,如果未能解决你的问题,请参考以下文章
Detox - 测试模式在 React Native 中的可见性
执行“detox test”命令时,iOS 模拟器应用程序无法启动 #2305
Detox android 测试引用了错误的 Android SDK 路径。 “目录中没有“aapt”可执行文件”
排毒(Android):device.reloadReactNative 失败
使用 Detox 测试与超时相关的测试,例如 Popups/Tooltips 等
运行 detox/wix 测试用例 android.util.AndroidException: INSTRUMENTATION_FAILED: