Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Is there a way to set the avd name? #59

Closed
alex-benoit opened this issue Apr 30, 2020 · 12 comments · Fixed by #60
Closed

Is there a way to set the avd name? #59

alex-benoit opened this issue Apr 30, 2020 · 12 comments · Fixed by #60
Assignees
Labels
enhancement New feature or request

Comments

@alex-benoit
Copy link

I get this error when running the tests on the emulator

Can not boot Android Emulator with the name: 'Nexus_5X_API_29_x86',
make sure you choose one of the available emulators: test

Is there a way to name the emulator so that I matches our development configuration?

@ychescale9
Copy link
Member

Not at the moment, but it’s easy to add a new config for this.
Could you share your workflow? I’m curious why you need a specific AVD name.

@alex-benoit
Copy link
Author

We use react native to build the android app
For UI testing we use the standard detox tool

As part of the setup, you need to setup the avdName you want the tool to use as part of the testing - see here https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#5-add-android-configuration

I have just created another config - android.emu.debug-cd - with the avdName as test and this should work - but it would be nice to pass the same avdName we use in development so that we share the config between our test and development environments

@alex-benoit
Copy link
Author

PS: this action is a life saver

@ychescale9
Copy link
Member

Cool I’ll add support for specifying avd-name this weekend.

@ychescale9 ychescale9 added the enhancement New feature or request label Apr 30, 2020
@ychescale9 ychescale9 self-assigned this Apr 30, 2020
@rigor789
Copy link

@alex-benoit in the meantime you can use --device-name or -n in the detox test command to overwrite config value!

@ychescale9
Copy link
Member

This is now supported:

with:
  api-level: 29
  avd-name: Nexus_5X_API_29_x86
  script: ./gradlew connectedCheck

@alex-benoit
Copy link
Author

@ychescale9 I am getting this now :(
adb: error: device 'emulator-5554' not found

      - name: Run Android UI Tests
        uses: reactivecircus/android-emulator-runner@v2
        with:
          api-level: 29
          arch: x86
          profile: Nexus 5X
          avd-name: Nexus_5X_API_29_x86
          script: npm run test-android-debug

@ychescale9
Copy link
Member

I just tested with your workflow and it seems to work. So looks like it's still not compatible with detox for some reason..

If you put adb devices in the script what do you see?

Can you please share the log?

@alex-benoit
Copy link
Author

alex-benoit commented May 4, 2020

List of devices attached
emulator-5554	device

You seem to also have this emulator id show up in your previous workflow:
adb -s emulator-5554 emu kill.

Not sure what is going on...

Full Log: 5_Run Android UI Tests.txt

@ychescale9
Copy link
Member

adb -s emulator-5554 emu kill is always run whether the script completes with or without an error so that the GitHub workflow can move on to the next step.

The log you attached looks perfectly fine. Can you share the log for the previous one with adb: error: device 'emulator-5554' not found? Sorry I'm not familiar with react native tooling.

@alex-benoit
Copy link
Author

5_Run Android UI Tests.txt

this is the previous one - maybe I'm missing something - I'm not expert either!

@rigor789
Copy link

rigor789 commented May 4, 2020

@alex-benoit what I found with detox is that it can start/stop the emulator for the tests. So I ended up creating a very simple action for my own workflows, that just creates the emulator but doesn't start it.

I haven't added a name to the emulator, it's test by default so I just use --device-name test and --cleanup in my detox command.

      - name: Create Emulator
        uses: rigor789/action-create-emulator@master

      - name: Test
        run: |
          detox test -c android.emu \
          --device-name test \
          --take-screenshots failing \
          --artifacts-location ./.artifacts/ \
          --cleanup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants