当执行“排毒测试”命令时,iOS模拟器应用无法启动#2305 说明日志

问题描述

说明

执行“排毒测试”命令后,iOS模拟器应用无法启动

排毒--loglevel verbose的输出显示[DetoxServer.js / CANNOT_FORWARD]

  • [x]我已经在最新的Detox版本中测试了此问题,并且仍然可以再现
再生产

排毒测试最后一次在四月进行,并具有以下设置

{
  "main": "node_modules/expo/AppEntry.js","scripts": {
    "start": "expo start","android": "expo start --android","ios": "expo start --ios","eject": "expo eject","test": "jest"
  },"dependencies": {
    "expo": "^37.0.0","react-native": "https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz",},"devDependencies": {
    "detox": "^15.3.0","detox-expo-helpers": "^0.6.0","expo-detox-hook": "^1.0.10","jest-expo": "^37.0.0","metro-react-native-babel-preset": "^0.53.1","react-native-testing-library": "^1.12.0","react-test-renderer": "^16.12.0","jest": {
    "preset": "jest-expo","transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|@sentry/.*|sentry-expo|native-base|react-native-multi-slider|@ptomasroos/.*)"
    ],"setupFilesAfterEnv": [
      "<rootDir>/unit_tests/setupTests.js"
    ],"testMatch": [
      "<rootDir>/unit_tests/**/*.test.js?(x)"
    ]
  },"detox": {
    "test-runner": "jest","configurations": {
      "ios.sim": {
        "binaryPath": "<app_name>.app","type": "ios.simulator","name": "iPhone 11 Pro Max"
      }
    }
  }
}

如上所述,它们现在失败,并带有以下package.json

{
  "main": "node_modules/expo/AppEntry.js","devDependencies": {
    "detox": "^17.4.5","transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community/async-storage/.*|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|@sentry/.*|sentry-expo|native-base|react-native-multi-slider|@ptomasroos/.*)"
    ],"name": "iPhone 11 Pro Max"
      }
    }
  }
}
预期行为

运行detox test应该在模拟器中打开应用程序并执行测试。

环境(请填写以下信息):
  • 排毒:17.4.5
  • 反应原生语言:0.61
  • 节点:v14.5.0
  • 设备:iOS模拟器iPhone 11 pro max
  • Xcode:11.3.1(使用EXPO进行开发)
  • iOS:13.3
  • macOS:10.14.4

日志

如果您在测试中遇到超时

尝试运行detox test --debug-synchronization 200

终端挂起并显示以下输出

detox[16107] INFO:  [test.js] debugSynchronization=200 reportSpecs=true useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1599257790958 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 e2e
detox[16109] INFO:  at e2e/tests/Auth/login.spec.js:11:11 
 describe(Auth)
detox[16109] INFO:  at e2e/init.js:21:19 
 beforeAll
detox[16109] INFO:  [DetoxServer.js] server listening on localhost:62081...
detox[16109] INFO:  at e2e/init.js:28:19 
 initialized

 RUNS  e2e/tests/Auth/login.spec.js

尝试添加“ detoxPrintBusyIdleResources”

终端挂起,输出为“使用“ category ==” EarlGreyStatistics“过滤日志数据”“

尝试添加“ disableSynchroniztion”。

运行detox test后,测试代码似乎停滞在“ await device.disableSynchronization”(在下一行代码中永远不会调用控制台日志)

设备和详细的排毒日志
  • [x]我已经使用--loglevel trace参数运行了测试,并在下面提供了详细的日志:
detox[15678] INFO:  [test.js] configuration="ios.sim" loglevel="verbose" cleanup=true reportSpecs=true useCustomLogger=true forceAdbInstall=false DETOX_START_TIMESTAMP=1599256657224 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 e2e
detox[15680] INFO:  at e2e/tests/Auth/login.spec.js:11:11 
 describe(Auth)
detox[15680] INFO:  at e2e/init.js:21:19 
 beforeAll
detox[15680] INFO:  [DetoxServer.js] server listening on localhost:61596...
detox[15680] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:61596
detox[15680] DEBUG: [DetoxServer.js/LOGIN] role=tester,sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester,sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [exec.js/EXEC_CMD,#0] applesimutils --list --byType "iPhone 11 Pro Max"
detox[15680] DEBUG: [exec.js/EXEC_CMD,#1] applesimutils --list --byId 0BABC374-4903-4E95-A1CB-C265C656F1D6 --maxResults 1
detox[15680] DEBUG: [exec.js/EXEC_CMD,#2] /usr/bin/xcrun simctl uninstall 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID]
detox[15680] DEBUG: [exec.js/EXEC_TRY,#2] Uninstalling [BUNDLE_ID]...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS,#2] [BUNDLE_ID] uninstalled
detox[15680] DEBUG: [exec.js/EXEC_CMD,#3] /usr/bin/xcrun simctl install 0BABC374-4903-4E95-A1CB-C265C656F1D6 "/Users/bryanboyko/XCode/<app_name>.app"
detox[15680] DEBUG: [exec.js/EXEC_TRY,#3] Installing /Users/bryanboyko/XCode/<app_name>.app...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS,#3] /Users/bryanboyko/XCode/<app_name>.app installed
detox[15680] INFO:  at e2e/init.js:28:19 
 initialized
detox[15680] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected,cannot fw action (sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773)
detox[15680] INFO:  Auth: should show main feed after manual login
detox[15680] INFO:  at e2e/init.js:57:19 
 before each
detox[15680] DEBUG: [exec.js/EXEC_CMD,#4] /usr/bin/xcrun simctl terminate 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID]
detox[15680] DEBUG: [exec.js/EXEC_TRY,#4] Terminating [BUNDLE_ID]...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS,#4] [BUNDLE_ID] terminated
detox[15680] DEBUG: [exec.js/EXEC_CMD,#5] applesimutils --byId 0BABC374-4903-4E95-A1CB-C265C656F1D6 --bundle [BUNDLE_ID] --restartSB --setPermissions location=inuse,notifications=YES
detox[15680] DEBUG: [exec.js/EXEC_TRY,#5] Trying to set permissions...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS,#5] Permissions are set
detox[15680] DEBUG: [exec.js/EXEC_CMD,#6] SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/bryanboyko/Library/ExpoDetoxHook/ios/58b2f26a0f87b2136ea15b6c467bcf04a21fd6e7/ExpoDetoxHook.framework/ExpoDetoxHook:/Users/bryanboyko/Library/Detox/ios/26afbf8d93760131ef9f1ae830bc7169ba83b8b0/Detox.framework/Detox" /usr/bin/xcrun simctl launch 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID] --args -detoxServer "ws://localhost:61596" -detoxSessionId "25a0b4f5-f767-48a9-1a95-ca18b51c4773" -EXKernelDisableNuxDefaultsKey "true" -detoxURLBlacklistRegex "\("http://192.168.1.19:19001/onchange","https://e.crashlytics.com/spi/v2/events"\)" -detoxURLOverride "exp://192.168.1.19:19000" -detoxSourceAppOverride "host.exp.exponent"
detox[15680] DEBUG: [exec.js/EXEC_TRY,#6] Launching [BUNDLE_ID]...
detox[15680] DEBUG: [exec.js/EXEC_CMD,#7] /usr/bin/xcrun simctl get_app_container 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID]
detox[15680] INFO:  [AppleSimUtils.js] [BUNDLE_ID] launched. To watch simulator logs,run:
        /usr/bin/xcrun simctl spawn 0BABC374-4903-4E95-A1CB-C265C656F1D6 log stream --level debug --style compact --predicate 'process == "[BUNDLE_ID]"'
detox[15680] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected,cannot fw action (sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773)
detox[15680] DEBUG: [DetoxServer.js/LOGIN] role=testee,sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee,sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] INFO:  at e2e/tests/Auth/login.spec.js:37:21 
 1st test
detox[15680] INFO:  Auth: should show main feed after manual login [FAIL]

detox[15680] INFO:  at e2e/init.js:73:19 
 after all
detox[15680] WARN:  [Client.js/PENDING_REQUESTS] App has not responded to the network requests below:
  (id = 1) setSyncSettings: {"enabled":false}
  (id = 2) invoke: {"type":"expectation","predicate":{"type":"id","value":"LOGIN_VIEW"},"expectation":"toBeVisible"}
  (id = -1000) isReady: {}

That might be the reason why the test "Auth should show main feed after manual login" has timed out.

detox[15680] DEBUG: [exec.js/EXEC_CMD,#8] /usr/bin/xcrun simctl shutdown 0BABC374-4903-4E95-A1CB-C265C656F1D6
detox[15680] DEBUG: [exec.js/EXEC_TRY,#8] Shutting down 0BABC374-4903-4E95-A1CB-C265C656F1D6...
detox[15680] DEBUG: [DetoxServer.js/DISCONNECT] role=tester,sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [DetoxServer.js/DISCONNECT] role=testee,sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773
detox[15680] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=tester not connected,cannot fw action (sessionId=25a0b4f5-f767-48a9-1a95-ca18b51c4773)
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS,#8] 0BABC374-4903-4E95-A1CB-C265C656F1D6 shut down
detox[15680] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
 FAIL  e2e/tests/Auth/login.spec.js (547.778s)
  Auth
    ✕ should show main feed after manual login (240426ms)

  ● Auth › should show main feed after manual login

    Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 300000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:25:45)

  ● Auth › should show main feed after manual login

    Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.

      at mapper (../node_modules/jest-jasmine2/build/queueRunner.js:25:45)

  ● Auth › should show main feed after manual login

    : Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 120000ms timeout specified by jest.setTimeout.

      30 | 
[private login info]
      34 | 
      35 |     // DOUBLE TAP LOGIN BUTTON

      at new Spec (../node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
      at Suite.<anonymous> (tests/Auth/login.spec.js:32:3)
      at Object.<anonymous> (tests/Auth/login.spec.js:10:1)

detox[15680] INFO:  at e2e/init.js:21:19 
 beforeAll
detox[15680] INFO:  [DetoxServer.js] server listening on localhost:61703...
detox[15680] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:61703
detox[15680] DEBUG: [DetoxServer.js/LOGIN] role=tester,sessionId=d7d6ad2d-d095-81b0-7955-6b83885362a3
detox[15680] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester,sessionId=d7d6ad2d-d095-81b0-7955-6b83885362a3
detox[15680] DEBUG: [exec.js/EXEC_CMD,#2] /usr/bin/xcrun simctl boot 0BABC374-4903-4E95-A1CB-C265C656F1D6 
detox[15680] DEBUG: [exec.js/EXEC_TRY,#2] Booting device 0BABC374-4903-4E95-A1CB-C265C656F1D6...
detox[15680] DEBUG: [exec.js/EXEC_CMD,#3] /usr/bin/xcrun simctl bootstatus 0BABC374-4903-4E95-A1CB-C265C656F1D6
detox[15680] DEBUG: [exec.js/EXEC_CMD,#4] /usr/bin/xcrun simctl io 0BABC374-4903-4E95-A1CB-C265C656F1D6 screenshot "/dev/null"
detox[15680] DEBUG: [exec.js/EXEC_CMD,#5] /usr/bin/xcrun simctl uninstall 0BABC374-4903-4E95-A1CB-C265C656F1D6 [BUNDLE_ID]
detox[15680] DEBUG: [exec.js/EXEC_TRY,#5] Uninstalling [BUNDLE_ID]...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS,#5] [BUNDLE_ID] uninstalled
detox[15680] DEBUG: [exec.js/EXEC_CMD,#6] /usr/bin/xcrun simctl install 0BABC374-4903-4E95-A1CB-C265C656F1D6 "/Users/bryanboyko/XCode/<app_name>.app"
detox[15680] DEBUG: [exec.js/EXEC_TRY,#6] Installing /Users/bryanboyko/XCode/<app_name>.app...
detox[15680] DEBUG: [exec.js/EXEC_SUCCESS,#6] /Users/bryanboyko/XCode/<app_name>.app installed
detox[15680] INFO:  at e2e/init.js:28:19 
 initialized
detox[15680] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected,cannot fw action (sessionId=d7d6ad2d-d095-81b0-7955-6b83885362a3)

 RUNS  e2e/tests/Auth/registration.spec.js

解决方法

我也遇到了这个问题,并且能够通过启动Xcode并启动与排毒模拟器无关的新模拟器来解决该问题。我的猜测是,通过Xcode启动新的模拟器有助于解决问题。

但是,我也知道通常应该避免使用disablingSynchronization。因此,我的第一个建议是对此进行评论,然后重试。如果这不起作用,请尝试将其注释掉的奇怪的Xcode hack,然后从那里删除。

作为参考,这是有关disableSynchronization的文档,该文档应说明为什么在可能的情况下应避免添加它:https://github.com/wix/detox/blob/master/docs/Troubleshooting.Synchronization.md#controlling-the-entire-synchronization-mechanism

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...