排毒测试命令失败,出现网络请求错误 #2665

问题描述

我正在使用具有以下配置的排毒:

"react": "16.13.1","react-native": "0.63.4" "detox": "^18.6.2","jest": "^26.6.3","jest-circus": "^26.6.3"

detox build 命令运行完美,但 detox 测试失败并出现以下错误

detox[13327] INFO:  [DetoxServer.js] server listening on localhost:59074...
detox[13327] INFO:  Example is assigned to emulator-17544 (Pixel_API_28_AOSP)
detox[13327] INFO:  Example: should have welcome screen
detox[13327] INFO:  Example: should have welcome screen [FAIL]

detox[13327] 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.

 FAIL  e2e/firstTest.e2e.js
  Example
    ✕ should have welcome screen

  ● 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[13326] ERROR: [cli.js] Error: Command Failed: jest --config e2e/config.json --testNamePattern '^((?!:ios:).)*$' --maxWorkers 1 e2e

我认为 device.launchApp() 存在一些问题,因为应用程序也没有启动!

我的第一个Test.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('EditTextId'))).toBeVisible();
  });
});

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)