I have an espresso test I'm writing for a feature, and the feature uses a broadcast receiver filtering the Intent.ACTION_TIME_TICK action. Essentially, the onReceive(..) is triggered every minute by the system, and my UI may or may not update. Problem is, my UI test right now has to sleep for 1 minute to ensure the onReceive(..) has triggered at least once before executing a statement assuming the onReceive(..) has triggered the UI update.
I want to get rid of the sleep code and manually trigger the onReceive(..) on behalf of the system, but Android documents this is not possible with Intent.ACTION_TIME_TICK.
This is a protected intent that can only be sent by the system.
Is it possible to achieve what I want or perhaps a different approach entirely?