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.