Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pre-started android emulator support #1027

Closed
jgreen210 opened this issue Nov 6, 2018 · 0 comments · Fixed by #1028
Closed

pre-started android emulator support #1027

jgreen210 opened this issue Nov 6, 2018 · 0 comments · Fixed by #1028
Assignees

Comments

@jgreen210
Copy link

Description

I'd like to be able to use detox with a pre-started android emulator. However, if I configure detox with "type" of "android.attached", and set --device-name to e.g. emulator-5554, I get the following error:

    Could not find 'emulator-5554' on the currently ADB attached devices: '[{"type":"emulator","name":"android-27-480x800-mdpi","adbName":"emulator-5554","port":"5554"}]', 
          try restarting adb 'adb kill-server && adb start-server'
      
      at AttachedAndroidDriver.findDeviceId (node_modules/detox/src/devices/drivers/AndroidDriver.js:192:15)

It fails like this since https://github.com/wix/Detox/blob/9.0.4/detox/src/devices/drivers/AttachedAndroidDriver.js is using "name" not "adbName" when calling findDeviceId(). For android emulators, detox sets "name" to the AVD name, not the adb id.

Using the avd name for --device-name didn't work. That makes sense, since this option is generally interpreted as adb id within detox.

Using a "type" of android.emulator didn't work either. This is also reasonable - it exists to make detox start an emulator, so shouldn't use a pre-existing one.

If I patch isEmulator() to return false, then detox does work with a pre-started emulator. This is since "name" and "adbName" both get set to the adb id for non-emulators.

(This is for a standard android emulator, not genymotion.)

Steps to Reproduce

package.json

  "detox": {
    "test-runner": "jest",
    "runner-config": "e2e/config.json",
    "configurations": {
      "android": {
        "binaryPath": "something.apk",
        "build": "",
        "type": "android.attached",
        "name": "emulator-5554"
      }
  }

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 9.0.4
  • React Native: 0.55.4
  • Node: 8.9.4
  • Device: android emulator
  • Xcode: 9.4.1
  • macOS: 10.13.6

Device and verbose Detox logs

    Could not find 'emulator-5554' on the currently ADB attached devices: '[{"type":"emulator","name":"android-27-480x800-mdpi","adbName":"emulator-5554","port":"5554"}]', 
          try restarting adb 'adb kill-server && adb start-server'
      
      at AttachedAndroidDriver.findDeviceId (node_modules/detox/src/devices/drivers/AndroidDriver.js:192:15)
noomorph added a commit that referenced this issue Nov 7, 2018
@noomorph noomorph self-assigned this Nov 7, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Nov 10, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants