排毒挂在 detox.init
Posted
技术标签:
【中文标题】排毒挂在 detox.init【英文标题】:Detox hanging at detox.init 【发布时间】:2020-02-20 13:47:49 【问题描述】:我正在尝试使用 detox e2e 测试设置一个 react-native 应用程序。我以前使用过 expo,但已经弹出到裸露,然后完全删除 expo。
但是,我仍然收到 device/element
未定义:
beforeAll(async () =>
console.log('DETOX init start');
await device.launchApp(
permissions:
notifications: 'YES',
,
newInstance: true,
launchArgs: detoxPrintBusyIdleResources: 'YES' ,
);
console.log('DETOX init end');
);
我从来没有联系过DETOX init end
。这些是日志:
我必须添加更多描述,因为 *** 说我添加了太多代码而没有足够的描述......
detox[20496] INFO: [test.js] configuration="ios.sim.debug" loglevel="verbose" debugSynchronization=1000 artifactsLocation="artifacts/ios.sim.debug.2019-10-24 08-13-29Z" recordLogs="none" takeScreenshots="manual" recordVideos="none" recordPerformance="none" reportSpecs=true node_modules/.bin/jest --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$' "e2e"
console.log e2e/init.js:20
DETOX init start
detox[20497] INFO: [DetoxServer.js] server listening on localhost:61858...
detox[20497] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:61858
detox[20497] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3
detox[20497] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3
detox[20497] DEBUG: [exec.js/EXEC_CMD, #0] /usr/bin/xcrun simctl list -j
detox[20497] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byType "iPhone 11" --byOS "13.0"
detox[20497] DEBUG: [exec.js/EXEC_TRY, #1] Searching for device matching iPhone 11...
detox[20497] DEBUG: [exec.js/EXEC_CMD, #2] applesimutils --list --byId "D84CAC90-F9FA-4811-9882-556E0D5FC298"
detox[20497] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl uninstall D84CAC90-F9FA-4811-9882-556E0D5FC298 com.iynk.iynk
detox[20497] DEBUG: [exec.js/EXEC_TRY, #3] Uninstalling com.iynk.iynk...
detox[20497] DEBUG: [exec.js/EXEC_SUCCESS, #3] com.iynk.iynk uninstalled
detox[20497] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl install D84CAC90-F9FA-4811-9882-556E0D5FC298 "/Users/alexchin/ReactNative/iynk-react-app/ios/build/Build/Products/Debug-iphonesimulator/iynk.app"
detox[20497] DEBUG: [exec.js/EXEC_TRY, #4] Installing /Users/alexchin/ReactNative/iynk-react-app/ios/build/Build/Products/Debug-iphonesimulator/iynk.app...
detox[20497] DEBUG: [exec.js/EXEC_SUCCESS, #4] /Users/alexchin/ReactNative/iynk-react-app/ios/build/Build/Products/Debug-iphonesimulator/iynk.app installed
detox[20497] DEBUG: [exec.js/EXEC_CMD, #5] /usr/bin/xcrun simctl terminate D84CAC90-F9FA-4811-9882-556E0D5FC298 com.iynk.iynk
detox[20497] DEBUG: [exec.js/EXEC_TRY, #5] Terminating com.iynk.iynk...
detox[20497] DEBUG: [exec.js/EXEC_SUCCESS, #5] com.iynk.iynk terminated
detox[20497] DEBUG: [exec.js/EXEC_CMD, #6] applesimutils --byId D84CAC90-F9FA-4811-9882-556E0D5FC298 --bundle com.iynk.iynk --restartSB --setPermissions notifications=YES,location=always
detox[20497] DEBUG: [exec.js/EXEC_TRY, #6] Trying to set permissions...
detox[20497] DEBUG: [exec.js/EXEC_SUCCESS, #6] Permissions are set
detox[20497] DEBUG: [exec.js/EXEC_CMD, #7] SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/alexchin/Library/Detox/ios/78aa16e822eb448600c2df3ca9fa600001357d63/Detox.framework/Detox" /usr/bin/xcrun simctl launch D84CAC90-F9FA-4811-9882-556E0D5FC298 com.iynk.iynk --args -detoxServer "ws://localhost:61858" -detoxSessionId "098db8fa-106e-c11b-8deb-2e3121feb5f3" -detoxPrintBusyIdleResources "YES"
detox[20497] DEBUG: [exec.js/EXEC_TRY, #7] Launching com.iynk.iynk...
detox[20497] DEBUG: [exec.js/EXEC_CMD, #8] /usr/bin/xcrun simctl get_app_container D84CAC90-F9FA-4811-9882-556E0D5FC298 com.iynk.iynk
detox[20497] INFO: [AppleSimUtils.js] com.iynk.iynk launched. To watch simulator logs, run:
/usr/bin/xcrun simctl spawn D84CAC90-F9FA-4811-9882-556E0D5FC298 log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/alexchin/Library/Developer/CoreSimulator/Devices/D84CAC90-F9FA-4811-9882-556E0D5FC298/data/Containers/Bundle/Application/A6F12D73-F6C9-435F-B020-E866833F73E3/iynk.app"'
detox[20497] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3)
detox[20497] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3
detox[20497] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3
Login: should have login screen
detox[20497] ERROR: [Detox.js/APP_CRASH] App crashed in test 'Login should have login screen', here's the native stack trace:
Signal 11 was raised
(
0 Detox 0x0000000104a88644 _ZL16__DTXHandleCrashP11NSExceptionP8NSNumberP8NSString + 497
1 Detox 0x0000000104a883c9 _ZL17__DTXHandleSignali + 59
2 libsystem_platform.dylib 0x00007fff51414b5d _sigtramp + 29
3 ??? 0x0000000000000000 0x0 + 0
4 CoreFoundation 0x00007fff23b20d7a __CFStringAppendFormatCore + 12426
5 CoreFoundation 0x00007fff23b22d15 _CFStringCreateWithFormatAndArgumentsAux2 + 133
6 Foundation 0x00007fff25677fa2 +[NSString stringWithFormat:] + 169
7 Detox 0x0000000104a7c770 ___prettyPrintAppStateTracker_block_invoke_2 + 87
8 CoreFoundation 0x00007fff23b669e7 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 7
9 CoreFoundation 0x00007fff23c095ce -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 190
10 Detox 0x0000000104a7c632 ___prettyPrintAppStateTracker_block_invoke + 275
11 libdispatch.dylib 0x00007fff511fc7f9 _dispatch_client_callout + 8
12 libdispatch.dylib 0x00007fff512097ff _dispatch_lane_barrier_sync_invoke_and_complete + 94
13 EarlGrey 0x0000000104b8800e grey_dispatch_sync + 238
14 Detox 0x0000000104a7c4a0 _prettyPrintAppStateTracker + 309
15 Detox 0x0000000104a7aa36 __WXFixupIdlingResourceClasses_block_invoke_2 + 392
16 EarlGrey 0x0000000104bfd8ff -[GREYUIThreadExecutor grey_busyResourcesReturnEarly:] + 1343
17 EarlGrey 0x0000000104bfd0ae -[GREYUIThreadExecutor grey_areAllResourcesIdle] + 62
18 EarlGrey 0x0000000104bfcc19 __59-[GREYUIThreadExecutor executeSyncWithTimeout:block:error:]_block_invoke.102 + 57
19 EarlGrey 0x0000000104ba9cfe __77-[GREYRunLoopSpinner grey_drainRunLoopInActiveModeAndCheckCondition:forTime:]_block_invoke + 350
20 EarlGrey 0x0000000104baabdc __89-[GREYRunLoopSpinner grey_setupObserverInMode:withBeforeSourcesBlock:beforeWaitingBlock:]_block_invoke + 268
21 CoreFoundation 0x00007fff23afaeb7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
22 CoreFoundation 0x00007fff23af594e __CFRunLoopDoObservers + 430
23 CoreFoundation 0x00007fff23af5eb3 __CFRunLoopRun + 1235
24 CoreFoundation 0x00007fff23af56b6 CFRunLoopRunSpecific + 438
25 EarlGrey 0x0000000104ba981b -[GREYRunLoopSpinner grey_drainRunLoopInActiveModeAndCheckCondition:forTime:] + 651
26 EarlGrey 0x0000000104ba915b -[GREYRunLoopSpinner spinWithStopConditionBlock:] + 635
27 EarlGrey 0x0000000104bfc2cf -[GREYUIThreadExecutor executeSyncWithTimeout:block:error:] + 1343
28 EarlGrey 0x0000000104bfbd45 -[GREYUIThreadExecutor executeSync:error:] + 309
29 Detox 0x0000000104a7a4e5 __45-[EarlGreyImpl(Detox) detox_safeExecuteSync:]_block_invoke + 137
30 CoreFoundation 0x00007fff23afb8ec __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
31 CoreFoundation 0x00007fff23afb058 __CFRunLoopDoBlocks + 312
32 CoreFoundation 0x00007fff23af5ee4 __CFRunLoopRun + 1284
33 CoreFoundation 0x00007fff23af56b6 CFRunLoopRunSpecific + 438
34 GraphicsServices 0x00007fff3815cbb0 GSEventRunModal + 65
35 Detox 0x0000000104a7e045 __detox_UIApplication_run + 365
36 UIKitCore 0x00007fff47162a67 UIApplicationMain + 1621
37 iynk 0x00000001007c8b20 main + 112
38 libdyld.dylib 0x00007fff5123bcf5 start + 1
)
detox[20497] DEBUG: [exec.js/EXEC_CMD, #9] /usr/bin/xcrun simctl terminate D84CAC90-F9FA-4811-9882-556E0D5FC298 com.iynk.iynk
detox[20497] DEBUG: [exec.js/EXEC_TRY, #9] Terminating com.iynk.iynk...
detox[20497] DEBUG: [exec.js/EXEC_SUCCESS, #9] com.iynk.iynk terminated
detox[20497] DEBUG: [exec.js/EXEC_CMD, #10] SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/alexchin/Library/Detox/ios/78aa16e822eb448600c2df3ca9fa600001357d63/Detox.framework/Detox" /usr/bin/xcrun simctl launch D84CAC90-F9FA-4811-9882-556E0D5FC298 com.iynk.iynk --args -detoxServer "ws://localhost:61858" -detoxSessionId "098db8fa-106e-c11b-8deb-2e3121feb5f3"
detox[20497] DEBUG: [exec.js/EXEC_TRY, #10] Launching com.iynk.iynk...
detox[20497] DEBUG: [DetoxServer.js/DISCONNECT] role=testee, sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3
detox[20497] DEBUG: [exec.js/EXEC_CMD, #11] /usr/bin/xcrun simctl get_app_container D84CAC90-F9FA-4811-9882-556E0D5FC298 com.iynk.iynk
detox[20497] INFO: [AppleSimUtils.js] com.iynk.iynk launched. To watch simulator logs, run:
/usr/bin/xcrun simctl spawn D84CAC90-F9FA-4811-9882-556E0D5FC298 log stream --level debug --style compact --predicate 'processImagePath beginsWith "/Users/alexchin/Library/Developer/CoreSimulator/Devices/D84CAC90-F9FA-4811-9882-556E0D5FC298/data/Containers/Bundle/Application/A6F12D73-F6C9-435F-B020-E866833F73E3/iynk.app"'
detox[20497] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3)
detox[20497] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3
detox[20497] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=098db8fa-106e-c11b-8deb-2e3121feb5f3
【问题讨论】:
不是特别有用,但我遇到了 xcode 11.1 和 detox@~12 的问题。测试在我们仍在运行 xcode 10.3 的构建服务器上运行良好 @Clarkie 我目前正在使用 Xcode 11.0 【参考方案1】:我认为您需要在device.launchApp()
之前添加一行代码detox.init()
来启动模拟器
【讨论】:
以上是关于排毒挂在 detox.init的主要内容,如果未能解决你的问题,请参考以下文章