Detox cannot interact with Android emulator


#1

Hey. I tried to run detox e2n tests on android emulator. All steps works fine, Android emulator booted, but seems like detox cannot interact with him and all test were failed by timeout.

here my .yml

    before_run: []
    after_run: []
    steps:
    - 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 android.emu.release
        title: Detox - Build Release App (Android)
    - avd-manager@0.9.2: {}
    - wait-for-android-emulator@1.0.4:
        inputs:
        - boot_timeout: '800'
    - script:
        inputs:
        - is_debug: 'yes'
        - content: |-
            #!/bin/bash

            detox test --configuration android.emu.release --cleanup
        title: Detox - Run E2E Tests (android)

I got the following error:

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

I run this on Hybrid (Xamarin, Ionic, ...) on macOS, includes Visual Studio for Mac, Stable channel and with x86 android emulator.

But I am sure that all of these works correctly.


#2

Hello there!

Our guide on detox test just came out, could you check it out, maybe it can help you out in this case: https://devcenter.bitrise.io/testing/running-detox-tests-on-bitrise/


#3

Thanks. I have already saw it. Unfortunately this guide describe only build for iOS. Build for iOS works fine, but I have a trouble with running detox on Android. Is there a guide how I can run detox tests for Android on bitrise?


#4

Could you please send me the latest build’s url where you tried this? maybe I can get something from the logs :upside_down_face:


#5

Here is my failed build https://app.bitrise.io/build/705ad0a7cf10ebd9
I am not sure that this url will work for you, because app is private


#6

Hey,

Where do you set for the test to which emulator to install the app? :thinking:
and/or the artifact location could be wrong,
also I’m not really sure, but don’t you need an apk to use with the emulator? :thinking:


#7

I run detox tests in .yml by this line detox test --configuration android.emu.release --cleanup that use this config from my package.json

"android.emu.release": {
        "binaryPath": "android/app/build/outputs/apk/e2e/release/app-e2e-release.apk",
        "build": "cd android && ./gradlew assembleE2eRelease assembleAndroidTest -DtestBuildType=release && cd ..",
        "type": "android.emulator",
        "name": "emulator"
      }


#8

and I guess the Detox - Build Release App step is generating the apk file, I see it runs a gradle task but I can’t find the apk output of the step :confused:
also I have doubts about the emulator name, only because I can’t find it in the logs, only an ID that is “emulator” and a serial that is emulator-5554