wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.17k stars 1.92k forks source link

Android emulator auto-select #3699

Open d4vidi opened 1 year ago

d4vidi commented 1 year ago

Describe your idea

For the Google emulators case, which is the common case when using Detox (on Android), it is mandatory for the onboarding developer to run adb devices / check Android Studio / dig into the SaaS machine's setup in order to select the emulator Detox should run on. While more fail-proof, as a process, it is a bit clunky and probably helps over-complicate the already complex setup flow.

My proposal is that initially, Detox would be integrated (e.g. using detox init) such that the device to use would be in a special mode called auto - which would tell Detox to auot-select an emulator*, based on some logic:

"devices": {
  "android": {
    "type": "android.emulator",
    "device": {
+      "avdName": "auto",
    }
  }
}

Or, in a way, slightly more idiomatic:

"devices": {
  "android": {
    "type": "android.emulator",
+    "name": "auto",
  }
}

Alternatively, the default behavior could be selected in response to not having avd-name specifics in the configuration, so as to ease even further both the developer and our config parsing logic.

"devices": {
  "android": {
    "type": "android.emulator",
-    "device": {
-      "avdName": "auto"
-    }
  }
}

==> Implies 'auto'

This will have to come with a cost elsewhere, of course:


* BTW, this is how Android (native) instrumentation testing works.

GiovaniBiagi commented 4 months ago

Any update on this point? I'm developing a small CLI to give the user the power to select available virtual devices. It's not a very pretty solution but it will have to be that way for now.