Create the main Progressbar wrapper in your main source code. Use it instead of the android.widget.Progressbar
as it will just forward all calls to the default Progressbar.
In your androidTest package create the Progressbar
class in the exact same package as you did in the main source code. This way all your UI tests will call this ProgressBar
instead of the default one.
And since the modifications prevent the Progressbar from showing and animating, the UI thread won't be blocked and Espresso can continue the test.
Thank you for this! It works like a charm. And so ends a 24 hour period of pulling my hair out. I just can't figure out how to suppress the warning about the duplicate classes from Android Studio.