问题描述
detox test -c Adebug --loglevel verbose
detox[13529] INFO: [test.js] DetoX_CONfigURATION="Adebug" DetoX_FORCE_ADB_INSTALL=false DetoX_LOGLEVEL="verbose" DetoX_READ_ONLY_EMU=false DetoX_REPORT_Specs=true DetoX_START_TIMESTAMP=1616519506213 DetoX_USE_CUSTOM_LOGGER=true jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e
detox[13530] INFO: [DetoxServer.js] server listening on localhost:56236...
detox[13530] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:56236
detox[13530] DEBUG: [DetoxServer.js/LOGIN] role=tester,sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36
detox[13530] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester,sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36
detox[13530] DEBUG: [exec.js/EXEC_CMD,#0] "/Users/medsalahbdioui/Library/Android/sdk/emulator/emulator" -list-avds --verbose
detox[13530] DEBUG: [exec.js/EXEC_CMD,#1] "/Users/medsalahbdioui/Library/Android/sdk/emulator/emulator" -version
detox[13530] DEBUG: [EmulatorVersionResolver.js/EMU_BIN_VERSION_DETECT] Detected emulator binary version { major: 30,minor: 4,patch: 5,toString: [Function: toString] }
detox[13530] DEBUG: [EmulatorDeviceAllocation.js/ALLOCATE_DEVICE] Trying to allocate a device based on "Pixel_3"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#2] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" devices
detox[13530] DEBUG: [exec.js/EXEC_SUCCESS,#2] List of devices attached
emulator-16296 device
detox[13530] DEBUG: [FreeDeviceFinder.js/DEVICE_LOOKUP] Found a matching & free device emulator-16296
detox[13530] DEBUG: [EmulatorDeviceAllocation.js/ALLOCATE_DEVICE] Settled on emulator-16296
detox[13530] DEBUG: [exec.js/EXEC_CMD,#3] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "getprop dev.bootcomplete"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#4] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "getprop ro.build.version.sdk"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#5] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "settings put global animator_duration_scale 0"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#6] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "settings put global window_animation_scale 0"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#7] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "settings put global transition_animation_scale 0"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#8] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "dumpsys power | grep \"^[ ]*m[UW].*=\""
detox[13530] DEBUG: [exec.js/EXEC_CMD,#9] "/Users/medsalahbdioui/Library/Android/sdk/build-tools/30.0.3/aapt" dump badging "/Users/medsalahbdioui/reactProjects/dailyPso/android/app/build/outputs/apk/dev/debug/app-dev-debug.apk" | grep -e "package: name="
detox[13530] DEBUG: [exec.js/EXEC_CMD,#10] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "am force-stop fr.infostrates.dailypsodev"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#11] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm list packages fr.infostrates.dailypsodev"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#12] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 uninstall fr.infostrates.dailypsodev
detox[13530] DEBUG: [exec.js/EXEC_CMD,#13] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm list packages fr.infostrates.dailypsodev.test"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#14] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 uninstall fr.infostrates.dailypsodev.test
detox[13530] DEBUG: [exec.js/EXEC_CMD,#15] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "rm -fr /data/local/tmp/detox"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#16] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "mkdir -p /data/local/tmp/detox"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#17] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 push "/Users/medsalahbdioui/reactProjects/dailyPso/android/app/build/outputs/apk/dev/debug/app-dev-debug.apk" "/data/local/tmp/detox/Application.apk"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#18] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm install -r -g -t /data/local/tmp/detox/Application.apk"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#19] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 push "/Users/medsalahbdioui/reactProjects/dailyPso/android/app/build/outputs/apk/androidTest/dev/debug/app-dev-debug-androidTest.apk" "/data/local/tmp/detox/Test.apk"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#20] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm install -r -g -t /data/local/tmp/detox/Test.apk"
detox[13530] INFO: Example is assigned to emulator-16296 (Pixel_3)
detox[13530] DEBUG: [exec.js/EXEC_CMD,#21] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "am force-stop fr.infostrates.dailypsodev"
detox[13530] DEBUG: [exec.js/EXEC_CMD,#22] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "date +\"%m-%d %T.000\""
detox[13530] DEBUG: [exec.js/EXEC_CMD,#23] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 reverse tcp:56236 tcp:56236
detox[13530] DEBUG: [exec.js/EXEC_CMD,#24] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "pm list instrumentation"
detox[13530] DEBUG: [exec.js/SPAWN_CMD,#25] [pid=13561] /Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb -s emulator-16296 shell am instrument -w -r -e detoxServer ws://localhost:56236 -e detoxSessionId 3529d3cf-9fa0-d471-2c8e-738e1be0eb36 -e debug false fr.infostrates.dailypsodev.test/androidx.test.runner.AndroidJUnitRunner
detox[13530] DEBUG: [exec.js/EXEC_CMD,#26] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""
detox[13530] ERROR: [exec.js/EXEC_FAIL,#26] ""/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""" Failed with error = ChildProcessError: Command Failed: "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""
`"/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""` (exited with error code 1) (code=1),stdout and stderr:
detox[13530] ERROR: [exec.js/EXEC_FAIL,#26]
detox[13530] ERROR: [exec.js/EXEC_FAIL,#26]
detox[13530] DEBUG: [exec.js/EXEC_CMD,#27] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 shell "ps | grep \"fr\.infostrates\.dailypsodev$\""
detox[13530] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=app not connected,cannot fw action (sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36)
detox[13530] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=app not connected,cannot fw action (sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36)
detox[13530] DEBUG: [exec.js/KILL] sending SIGINT to [pid = 13561]: /Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb -s emulator-16296 shell am instrument -w -r -e detoxServer ws://localhost:56236 -e detoxSessionId 3529d3cf-9fa0-d471-2c8e-738e1be0eb36 -e debug false fr.infostrates.dailypsodev.test/androidx.test.runner.AndroidJUnitRunner
detox[13530] DEBUG: [exec.js/EXEC_CMD,#28] "/Users/medsalahbdioui/Library/Android/sdk/platform-tools/adb" -s emulator-16296 reverse --remove tcp:56236
detox[13530] INFO: Example: should have welcome screen
detox[13530] INFO: Example: should have welcome screen [FAIL]
detox[13530] WARN: [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
(id = -1000) isReady: {}
Unresponded network requests might result in timeout errors in Detox tests.
detox[13530] DEBUG: [DetoxServer.js/disCONNECT] role=tester,sessionId=3529d3cf-9fa0-d471-2c8e-738e1be0eb36
detox[13530] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
FAIL e2e/firstTest.e2e.js (18.393 s)
Example
✕ should have welcome screen (1 ms)
● Example › should have welcome screen
DetoxRuntimeError: Failed to run application on the device
HINT: Most likely,your tests have timed out and called detox.cleanup() while it was waiting for "ready" message (over WebSocket) from the instrumentation process.
at MonitoredInstrumentation._getInstrumentationCrashError (../node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:68:12)
at MonitoredInstrumentation._rejectPendingCrashPromise (../node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:56:37)
at MonitoredInstrumentation._onInstrumentationTerminated (../node_modules/detox/src/devices/drivers/android/tools/MonitoredInstrumentation.js:51:10)
at Instrumentation._onTerminated (../node_modules/detox/src/devices/drivers/android/tools/Instrumentation.js:52:18)
detox[13529] ERROR: [cli.js] Command Failed: jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e
{
"testRunner": "jest","runnerConfig": "e2e/config.json","devices": {
"android.attached": {
"type": "android.attached","device": {
"adbname": "278a2cdd6e1c7ece"
}
},"emulator": {
"type": "android.emulator","device": {
"avdName": "Pixel_3"
}
},"simulator":{
"type": "ios.simulator","device": {
"type": "iPhone 12"
}
}
},"apps": {
"android.debug": {
"type": "android.apk","binaryPath": "android/app/build/outputs/apk/dev/debug/app-dev-debug.apk","build": "cd android && ./gradlew assembleDebug -DtestBuildType=debug && cd .."
},"android.release": {
"type": "android.apk","binaryPath": "android/app/build/outputs/apk/release/app-release.apk","build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd .."
},"ios.debug": {
"type": "ios.app","binaryPath": "ios/staging.app","build": "xcodebuild -workspace ios/dailypso.xcworkspace -configuration Debug -sdk iphonesimulator -scheme staging -derivedDataPath ios/build"
},"ios.release": {
"type": "ios.app","build": "xcodebuild -workspace ios/detox_poc.xcworkspace -configuration Debug -sdk iphonesimulator -scheme detox_poc -derivedDataPath ios/build"
}
},"configurations": {
"android.attached":{
"device":"android.attached","app": "android.debug"
},"Adebug": {
"device": "emulator","Arelease": {
"device": "emulator","app": "android.release"
},"Idebug": {
"device": "simulator","app": "ios.debug"
},"Irelease": {
"device": "simulator","app": "ios.release"
}
}
}
使用这些版本的软件包
本机反应:“0.63.4” 开玩笑:“^26.6.3”
只想从简单的测试代码开始 e2e/.firstTest.e2e.js
describe('Example',() => {
beforeAll(async () => {
await device.launchApp();
});
beforeEach(async () => {
await device.reloadReactNative();
});
it('should have welcome screen',async () => {
await expect(element(by.id('welcome'))).toBeVisible();
});
});
最后这个 android/build.gradle 配置
buildscript {
ext {
buildToolsversion = "29.0.3"
minSdkVersion = 18
compileSdkVersion = 27
targetSdkVersion = 27
kotlinVersion = '1.4.20'
// firebaseMessagingVersion = "21.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
classpath('com.google.gms:google-services:4.3.4')
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
任何想法???!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)