I'm working on some UI testing with Espresso on a map based application that use the user location.
It works: the user location is then faked to the lat long I coded. But after a while I get some trouble. After few tests I get a system popup that seems to be triggered by com.google.android.gms:play-services
that is embbeded in our application.
The message is "For a better experience, turn on device location, which uses Google's location service." as you can see on the picture below :
So it seems that the mocking code trigger somehow this popup and then ruins all the remaining tests since the popup does not dismiss until clicked on one of the buttons.
I know I could add a bit of code with UI Automator in order to validate the popup but I would like to avoid this workaround since:
Please note that I cannot reproduce this problem on my device or my emulator but only when I run my tests on gcloud (Firebase Test Lab)...
Have you ever faced this problem ? Do you have any idea how I can avoid this popup or any workaround that is not involving UI Automator?
Please remember that i'm running tests remotely, on a virtual device that is not logged into any Google Account. Also, I don't have access to the device system/settings but eventually I should be able to use ADB command to get some rights or apply some settings to the system.
Actually the mock location is partially supported on Firebase Test Lab on virtual devices. See my comment below for more information.
So depending the use case, switching to a real device can solve your problem like the problem mentionned in this topic.
What you are seeing may be a bug in Firebase Test Lab if it is happening on certain devices but works on others. E.g. works on a physical Samsung device but does not work on a physical HTC device. Or works on all physical devices but does not work on virtual devices.
Since I cannot message you directly on Stack Overflow, I encourage you to join the Firebase Test Lab Slack channel (#test-lab) on https://firebase-community.slack.com/.
There will be Firebase engineers actively investigating issues that you are seeing and look directly at the test runs you have run in your project.