5
votes

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