I am testing my Android app with Espresso and I am using mock locations. The mocking part is working fine.
Up to now, I was testing on an Android 8 device. I now have an Android 12 device, and when launching my activity, a system toast warning me that my app is using mock location is displayed during 5 seconds.
And this toast is displayed just above the widgets I want to click on, making my test to fail.
A work-around is to add a "sleep()" for 6 seconds. But it is only a work-around, and it makes tests much longer to run.
Is there a proper way to make this toast not appearing (during tests only) ?