Reputation: 51
I try to make a screenshot test with Espresso:
Test
class ScreenshotTest {
@get:Rule
var nameRule = TestName()
@get:Rule
var mActivityTestRule = ActivityTestRule(MainActivity::class.java)
@Test
fun saveActivityBitmap() {
capture(mActivityTestRule.activity).bitmap.writeToTestStorage(nameRule.methodName)
}}
Manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
but it failed with message:
No content provider registered for: content://androidx.test.services.storage.outputfiles/saveActivityBitmap.png. Are all test services apks installed?
It seems like necessary to tune ContentProvider...
Guys, may be anybody won this problem, or may be knows where is extensive documentation for writeToTestStorage method.
Google doesn't know about this and "developer.android.com" mentions about this method in release sheet only
Upvotes: 5
Views: 604
Reputation: 76669
This indeed depends upon test-services
:
androidTestImplementation("androidx.test.services:test-services:1.5.0")
Then find test-services-1.5.0.apk
in the Gradle cache, upload to device and install it ...
orchestrator-1.5.0.apk
is probably not required.
One can as well disable these screenshots altogether:
Espresso.setFailureHandler(DefaultFailureHandler(targetContext, false))
Upvotes: 0
Reputation: 41
I hope it would be helpful for someone. I faced with similar problem on microsoft appcenter. The reason is appcenter does not support orchestrator. This content provider is part of https://mvnrepository.com/artifact/androidx.test.services/test-services You should install orchestrator.apk and test-services.apk to run tests. When you run tests on your local emulator, gradle script does it for you, but appcenter does not
Upvotes: 0