TicTacV
TicTacV

Reputation: 81

detox test failed in ios - Aborted detox.init() execution

Trying to run a basic detox e2e for a sample react native application. I'm following this blog.

But the step detox test, doesn't run the tests. It just hangs in the simulator (in detox init phase), and failed due to timeout.

Does anyone have any idea how to solve it? or anyone has any working sample of detox?

Detox, Node, Device, Xcode and macOS Versions

detox 16.2.0 node v10.16.0 macOs 10.13.6 High Sierra Xcode Version 10.1

Error:

detox test
detox[89159] INFO:  [test.js] configuration="ios.release" reportSpecs=true useCustomLogger=true DETOX_START_TIMESTAMP=1586928640139 node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 "e2e"
detox[89160] INFO:  [DetoxServer.js] server listening on localhost:57696...
detox[89160] INFO:  [AppleSimUtils.js] org.reactjs.native.example.testAM launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn 52AC48F5-EC9A-4423-8947-11EB05E187E7 log stream --level debug --style compact --predicate 'process == "testAM"'
detox[89160] INFO:  Example: should have "Step One" section
detox[89160] ERROR: [DetoxExportWrapper.js/DETOX_INIT_ERROR] 
 { DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

HINT: Most likely, your test runner is tearing down the suite due to the timeout error
    at Detox.[_assertNoPendingInit] (/Users/test/dev/DetoxE2Etest/testAM/node_modules/detox/src/Detox.js:197:9)
    at Detox.beforeEach (/Users/test/dev/DetoxE2Etest/testAM/node_modules/detox/src/Detox.js:105:37)
    at DetoxExportWrapper.(anonymous function).args [as beforeEach] (/Users/test/dev/DetoxE2Etest/testAM/node_modules/detox/src/DetoxExportWrapper.js:63:32)
    at DetoxAdapterImpl.beforeEach (/Users/test/dev/DetoxE2Etest/testAM/node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22) name: 'DetoxRuntimeError' }
detox[89160] 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[89160] INFO:  Example: should have "Step One" section [FAIL]
detox[89160] INFO:  Example: should have "See Your Changes" section
detox[89160] INFO:  Example: should have "See Your Changes" section [FAIL]

 FAIL  e2e/firstTest.spec.js (301.625s)
  Example
    ✕ should have "Step One" section (20ms)
    ✕ should have "See Your Changes" section (3ms)

  ● Example › should have "Step One" section

    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:27:45)

  ● Example › should have "Step One" section

    DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

    HINT: Most likely, your test runner is tearing down the suite due to the timeout error

      at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
      at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
      at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
      at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)

  ● Example › should have "Step One" section

    DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

    HINT: Most likely, your test runner is tearing down the suite due to the timeout error

      at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
      at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
      at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
      at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)

  ● Example › should have "Step One" section

    DetoxRuntimeError: Detox instance has not been initialized

    HINT: There was an error on attempt to call detox.init()

    DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

    HINT: Most likely, your test runner is tearing down the suite due to the timeout error

      1 | describe('Example', () => {
      2 |   beforeEach(async () => {
    > 3 |     await device.reloadReactNative();
        |           ^
      4 |   });
      5 | 
      6 |   it('should have "Step One" section', async () => {

      at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
      at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
      at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
      at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
      at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
      at device (../node_modules/detox/src/utils/MissingDetox.js:46:16)
      at _callee$ (firstTest.spec.js:3:11)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
      at ../node_modules/regenerator-runtime/runtime.js:170:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:169:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:192:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
      at Object.exports.async (../node_modules/regenerator-runtime/runtime.js:219:14)
      at Object._callee (firstTest.spec.js:2:14)

  ● Example › should have "Step One" section

    DetoxRuntimeError: Detox instance has not been initialized

    HINT: There was an error on attempt to call detox.init()

    DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

    HINT: Most likely, your test runner is tearing down the suite due to the timeout error

      4 |   });
      5 | 
    > 6 |   it('should have "Step One" section', async () => {
        |                                        ^
      7 |     await expect(element(by.text('Step One'))).toBeVisible();
      8 |   });
      9 | 

      at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
      at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
      at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
      at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
      at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
      at get (../node_modules/detox/src/utils/MissingDetox.js:46:16)
      at _callee2$ (firstTest.spec.js:6:40)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
      at ../node_modules/regenerator-runtime/runtime.js:170:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:169:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:192:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
      at Object.exports.async (../node_modules/regenerator-runtime/runtime.js:219:14)
      at Object._callee2 (firstTest.spec.js:6:40)

  ● Example › should have "See Your Changes" section

    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:27:45)

  ● Example › should have "See Your Changes" section

    DetoxRuntimeError: Detox instance has not been initialized

    HINT: There was an error on attempt to call detox.init()

    DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

    HINT: Most likely, your test runner is tearing down the suite due to the timeout error

      at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
      at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
      at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
      at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
      at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
      at MissingDetox._defineRequiredProperty (../node_modules/detox/src/utils/MissingDetox.js:8:71)
      at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
      at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)

  ● Example › should have "See Your Changes" section

    DetoxRuntimeError: Detox instance has not been initialized

    HINT: There was an error on attempt to call detox.init()

    DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

    HINT: Most likely, your test runner is tearing down the suite due to the timeout error

      1 | describe('Example', () => {
      2 |   beforeEach(async () => {
    > 3 |     await device.reloadReactNative();
        |           ^
      4 |   });
      5 | 
      6 |   it('should have "Step One" section', async () => {

      at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
      at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
      at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
      at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
      at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
      at device (../node_modules/detox/src/utils/MissingDetox.js:46:16)
      at _callee$ (firstTest.spec.js:3:11)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
      at ../node_modules/regenerator-runtime/runtime.js:170:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:169:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:192:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
      at Object.exports.async (../node_modules/regenerator-runtime/runtime.js:219:14)
      at Object._callee (firstTest.spec.js:2:14)

  ● Example › should have "See Your Changes" section

    DetoxRuntimeError: Detox instance has not been initialized

    HINT: There was an error on attempt to call detox.init()

    DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()

    HINT: Most likely, your test runner is tearing down the suite due to the timeout error

       8 |   });
       9 | 
    > 10 |   it('should have "See Your Changes" section', async () => {
         |                                                ^
      11 |     await expect(element(by.text('See Your Changes'))).toBeVisible();
      12 |   });
      13 | });

      at Detox.[_assertNoPendingInit] (../node_modules/detox/src/Detox.js:197:9)
      at Detox.beforeEach (../node_modules/detox/src/Detox.js:105:37)
      at DetoxExportWrapper.(anonymous function).args [as beforeEach] (../node_modules/detox/src/DetoxExportWrapper.js:63:32)
      at DetoxAdapterImpl.beforeEach (../node_modules/detox/runners/jest/DetoxAdapterImpl.js:17:22)
      at MissingDetox.throwError (../node_modules/detox/src/utils/MissingDetox.js:67:11)
      at get (../node_modules/detox/src/utils/MissingDetox.js:46:16)
      at _callee3$ (firstTest.spec.js:10:48)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
      at Generator.invoke [as _invoke] (../node_modules/regenerator-runtime/runtime.js:274:22)
      at Generator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
      at tryCatch (../node_modules/regenerator-runtime/runtime.js:45:40)
      at invoke (../node_modules/regenerator-runtime/runtime.js:135:20)
      at ../node_modules/regenerator-runtime/runtime.js:170:11
      at callInvokeWithMethodAndArg (../node_modules/regenerator-runtime/runtime.js:169:16)
      at AsyncIterator.enqueue (../node_modules/regenerator-runtime/runtime.js:192:13)
      at AsyncIterator.prototype.(anonymous function) [as next] (../node_modules/regenerator-runtime/runtime.js:97:21)
      at Object.exports.async (../node_modules/regenerator-runtime/runtime.js:219:14)
      at Object._callee3 (firstTest.spec.js:10:48)

detox[89159] ERROR: [cli.js] Error: Command failed: node_modules/.bin/jest --config e2e/config.json '--testNamePattern=^((?!:android:).)*$' --maxWorkers 1 "e2e"

Upvotes: 8

Views: 1158

Answers (1)

Tal Biton
Tal Biton

Reputation: 21

I got to same error on GitHub action flow that I made,

to resolved it I changed emulators devices (Nexus -> Pixel -> etc..) and changed android api version until it worked,

it was a little bit frustrating but that what helped me (finally it worked for me on Nexus 6 with Android api 31 (default).

I think that you can also try in your main flow file (mine was mine.test.js) to add jest.setTimeout(120000) before the tested functions.

Another solution that I can think on is to add initally "reload"

beforeAll(async () => {
  await device.launchApp({ newInstance: true })
  await device.reloadReactNative()})

I hope you guys find some of this helpful, If nothing of it will work maybe reinstall Detox and follow more stictly the docs,

I assume it might be something with the versions.

Upvotes: 0

Related Questions