androidautomationcontinuous-integrationadbbitrise

abd emu geo fix <longitude> <latitude> is not working on Bitrise CI server


Requirement

We are required to conduct automated tests on a food delivery app which when launched it asks for permission to use the user's location and display a list of nearby restaurants.

Problem

When we run our tests on Bitrise the app fails to get the list of nearby restaurants because the CI server is in a different country.

Attempted Solutions

  1. Added "abd emu geo fix " to a script step in our Bitrise workflow right after creating and waiting for the emulator to launch
  2. Tried to specify the name of the emulator by "adb -s emulator-5554 emu geo fix "
  3. Tried "telnet localhost 5554" where the connection gets established then directly gets closed "connection closed by foreign host"

Investigations

  1. "abd emu geo fix " works fine locally
  2. "telnet localhost 5554" works fine locally

Notes

  1. We are using Android 9.0 (API 28) both locally and on Bitrise
  2. We are using JAVA 11 both locally and on Bitrise
  3. We are using a Pixel emulator both locally and on Bitrise

Hope somebody could help us out.


Solution

  • We had two solutions which are the following:

    1. Add an isAutomation flag to the staging app so that when the flag is true the app always takes a static longitude and latitude and does not take the current location of the device.

    2. Install a VPN on the server and specify the country we want, however, you should verify that the VPN has servers in the country you desire.

    Eventually we went with the isAutomation flag workaround.