The app has not responded to the network requests below

Hi I have received below error when I run the Android Emulator with Detox in Bitrise.

08:30:42.529 detox[4685] WARN:  [PENDING_REQUESTS] The app has not responded to the network requests below:
  (id = 1) currentStatus: {}
  (id = -1000) isReady: {}
Unresponded network requests might result in timeout errors in Detox tests.
08:30:47.564 detox[4685] ERROR: [Client.js/ERROR] The pending request #-49642 ("cleanup") has been rejected due to the following error:
The tester has not received a response within 5000ms timeout to the message:
Cleanup {
  type: 'cleanup',
  params: [Object],
  messageId: -49642
}
FAIL e2e/onboarding.e2e.js (312.225 s)
  Onboarding
    āœ• should have welcome screen (1 ms)
    āœ• should show login screen after tap
    āœ• should show signup screen after tap
    āœ• should show forgot password screen after tap
  ā— Onboarding ā€ŗ should have welcome screen
    thrown: "Exceeded timeout of 120000 ms for a hook.
    Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
      1 | describe('Onboarding', () => {
    > 2 |   beforeAll(async () => {
        |   ^
      3 |     await device.launchApp();
      4 |   });
      5 |
      at onboarding.e2e.js:2:3
      at Object.<anonymous> (onboarding.e2e.js:1:1)

Below is the Partial code snippet of files. Please let me know if anymore files are required.

Package.json:

"detox": "^19.3.1",
"expo-detox-hook": "^1.0.10",
"detox-expo-helpers": "^0.6.0"

Bitrise.yml:

format_version: '11'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: react-native
trigger_map:
- push_branch: 7610
  workflow: tests
workflows:
 tests:
    steps:
    - activate-ssh-key@4: {}
    - git-clone@6: {}
    - npm:
        inputs:
        - command: install
    - npm:
        inputs:
        - command: install -g detox-cli
        title: Install Detox CLI
    - npm:
        inputs:
        - command: install -g react-native-cli
        title: Install React Native CLI
    - script:
        inputs:
        - is_debug: 'yes'
        - content: |-
            #!/bin/bash

            detox build --configuration android24 --debug-synchronization 500
        title: Detox - Build Release App (Android)
    - avd-manager@1:
        inputs:
        - name: "$EMULATOR_NAME"
        - api_level: '24'
    - wait-for-android-emulator@1:
        inputs:
        - boot_timeout: '800'
    - script:
        inputs:
        - is_debug: 'yes'
        - content: |-
            #!/bin/bash

            /usr/local/share/android-sdk/emulator/emulator -list-avds
        title: Print Device
    - script:
        inputs:
        - is_debug: 'yes'
        - content: |-
            #!/bin/bash

            detox test --configuration android24 --cleanup --debug-synchronization
        title: Detox - Run E2E Tests (android)
meta:
  bitrise.io:
    stack: osx-xcode-13.1.x
app:
  envs:
  - opts:
      is_expand: false
    WORKDIR: "."
  - opts:
      is_expand: false
    PROJECT_LOCATION: android
  - opts:
      is_expand: false
    MODULE: AppBuddy
  - opts:
      is_expand: false
    VARIANT: Debug
  - opts:
      is_expand: false
    BITRISE_PROJECT_PATH: ios/App.xcworkspace
  - opts:
      is_expand: false
    BITRISE_SCHEME: App-Alpha
  - opts:
      is_expand: false
    BITRISE_DISTRIBUTION_METHOD: development
  - EMULATOR_NAME: pixel_3a_API_24
outputs:
- BITRISE_APK_PATH: android/App/build/outputs/apk/alpha/debug/App-alpha-debug.apk
  opts:
    title: Path of the generated APK
    summary: Path of the generated (and copied) APK - after filtering.
    description: |-
      This output will include the path of the generated APK
      after filtering based on the filter inputs.
      If the build generates more than one APK which fulfills the
      filter inputs, this output will contain the last one's path.

detoxrc.json:

 "android.alpha.debug": {
      "type": "android.apk",
      "binaryPath": "android/App/build/outputs/apk/alpha/debug/App-alpha-debug.apk",
      "build": "cd android && ./gradlew -Dorg.gradle.jvmargs=-Xmx1536m assembleAlphaDebug assembleAndroidTest -DtestBuildType=debug && cd .."
    },
    "emulator24": {
      "type": "android.emulator",
      "device": {
        "avdName": "emulator"
      }
    },
    "android24": {
      "device": "emulator24",
      "app": "android.alpha.debug"
    },
1 Like

i got the problem same here :no_mouth:

Did you solve that ?

Hi, same problem here.
Detox tests works for me on iOS and Android on my local machine.
On Bitrise Detox tests on iOS Simulator works OK, but Android fails with

$ detox test --configuration android.emu.debug --artifacts-location e2e/artifacts --record-logs failing --take-screenshots failing --loglevel error --workers 1
17:52:16.213 detox[7319] ERROR: [Client.js/ERROR] The pending request #-49642 ("cleanup") has been rejected due to the following error:
The tester has not received a response within 5000ms timeout to the message:
Cleanup {
  type: 'cleanup',
  params: [Object],
  messageId: -49642
}
FAIL e2e/addingActionsTests.e2e.js (133.798 s)

Hi there, I fixed the issue with the following steps:
1- Iā€™m using macOS VM not Ubuntu/Linux
2- In the AVD Manager Step: I increased the memory --sdcard 2048M
3- for some reasons Detox not running the Metro server, So I added a step to do that
npx react-native run-android
4- Added a step for rebuild detox: npm rebuild detox
5- Add force-adb command to install the app on the emulator
detox test -c android.emu.debug --record-logs all --take-screenshots all --record-videos all --force-adb-install
6- Finally Iā€™m copying the Detox artifacts to the Deply folder to be able to check the results and the screenshots in the Artifacts tab
cp -R artifacts $BITRISE_DEPLOY_DIR

RN-Android:
    steps:
    - avd-manager@1:
        inputs:
        - emulator_id: Pixel2API30
        - create_command_flags: "--sdcard 2048M"
        - api_level: '28'
    - wait-for-android-emulator@1:
        inputs:
        - boot_timeout: '800'
    - activate-ssh-key@4.1:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@6.2: {}
    - npm@1.1:
        inputs:
        - command: install
        title: NPM Install
    - script@1.2:
        title: Install Detox CLI and RN CLI
        inputs:
        - content: |-
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # debug log
            set -x
            #npm install -g react-native-cli
            npm install -g detox-cli
    - script@1:
        inputs:
        - content: |-
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
            set -o pipefail
            # debug log
            set -x
            # write your script here
            npx react-native run-android
        title: Build ReactNative Android
    - script@1.2:
        inputs:
        - content: |-
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # debug log
            set -x
            detox build -c android.emu.debug
        title: Detox Build Android
    - script@1:
        inputs:
        - content: |-
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully
            set -o pipefail
            # debug log
            set -x
            # write your script here
            npm rebuild detox
        title: Rebuild Detox
    - script@1.2:
        title: Detox E2E Android Test
        inputs:
        - content: |-
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # debug log
            set -x
            detox test -c android.emu.debug --record-logs all --take-screenshots all --record-videos all --force-adb-install
    - script@1.2:
        inputs:
        - content: |-
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # debug log
            set -x
            cp -R artifacts $BITRISE_DEPLOY_DIR
        title: Publish Test Artifacts
        is_always_run: true
    - deploy-to-bitrise-io@2.1:
        inputs:
        - is_compress: 'true'
    meta:
      bitrise.io:
        stack: osx-xcode-14.1.x
        machine_type_id: g2.8core

You can find the full bitrise.yml file here:
https://github.com/moatazeldebsy/reactnative-detox-demo/blob/main/bitrise.yml

I hope this will fix your issue :slightly_smiling_face:

same problem here. but it is not happening for all the tests