DEV Community

Cover image for Use Genymotion SaaS to run Maestro E2E on CI
Davyd NRB
Davyd NRB

Posted on

Use Genymotion SaaS to run Maestro E2E on CI

Genymotion service privide a huge amount of Android emulators that can be used to run Maestro E2E tests.

I'll try to provide you a short list of instructions in this article to help you create a workflow.


Let's first install gmsaas cli

pip3 install gmsaas
gmsaas config set android-sdk-path "$ANDROID_HOME"
Enter fullscreen mode Exit fullscreen mode

After that, you need to sign in (Obviously, you must signup first)

export GMSAAS_EMAIL="you-email@test.com"
export GMSAAS_PASSWORD="you-password"

gmsaas auth login $GMSAAS_EMAIL $GMSAAS_PASSWORD
Enter fullscreen mode Exit fullscreen mode

Let's begin by starting your first Android emulator now.

To start Android you need to know its recipes_id. You can make your own or use already created recipes:

gmsaas recipes list # print list available recipes
# ...
# 4c015ada-e64e-4f5d-a320-06cbf6e95648  Google Pixel 3a          10.0       1080 x 2220 dpi 420  genymotion
# 70eaaf75-bd9a-406d-9f01-682a5d400c6e  Samsung Galaxy S10       10.0       1440 x 3040 dpi 560  genymotion
# e104f058-b291-4764-8e0d-d9ff78a41192  Custom Phone             11.0       768 x 1280 dpi 320   genymotion
# c65db329-511a-4c2a-9761-c7259649e8c7  Custom Tablet            11.0       1536 x 2048 dpi 320  genymotion
# 95016679-8f8d-4890-b026-e4ad889aadf1  Google Pixel 3a          11.0       1080 x 2220 dpi 420  genymotion


INSTANCE_UUID=$(gmsaas instances start 95016679-8f8d-4890-b026-e4ad889aadf1 my_instance_name)
Enter fullscreen mode Exit fullscreen mode

Now, on the Virtual Devices page, you should be able to see a launched instance:

Image description

INSTANCE_UUID on the screenshot above have to store UUID value of that instance, using this UUIS you can connect a running instance to ADB:

gmsaas instances adbconnect $INSTANCE_UUID

$ANDROID_HOME/platform-tools/adb devices # check if it works
# List of devices attached
# localhost:34953   device
Enter fullscreen mode Exit fullscreen mode

when an instance will be connected you run Maestor e2e:

$ANDROID_HOME/platform-tools/adb install myApp.apk
# ^^^ install app
$HOME/.maestro/bin/maestro test .maestro/myTest.yaml
# ^^^ run tests
Enter fullscreen mode Exit fullscreen mode

video demonstration:

Finnaly when test pass don't forget to stop instance at the end:

gmsaas instances stop --no-wait $INSTANCE_UUID
Enter fullscreen mode Exit fullscreen mode

If you don't want to read the manual, just copy Maestro and Genymotion from my repository as working examples.

That also includes Github Actions configuration: android-genymotion-cloud.yaml

Image description

Top comments (0)