My app uses Storage Access Framework to allow the user to select where he/she want to download a file from the app. I want to write espresso test for the download feature.
intending(hasAction(ACTION_CREATE_DOCUMENT))
.respondWith(ActivityResult(RESULT_OK, Intent().apply {
data = Uri.parse(
"content://com.android.externalstorage.documents/document/primary%3ADownload%2Ftest.txt"
)
}))
The above shows how I respond to the ACTION_CREATE_DOCUMENT intent. The problem is that when I try to write this file the Document.fromSingleUri returns null. Is there a way to create a URI which is writeable using DocumentFile.fromSingleUri()
?
Aucun commentaire:
Enregistrer un commentaire