Open ssaqua opened 5 years ago
Hello, is there a solution or a workaround ?
Finally, I found the solution:
Set the clearAppDataBeforeEachTest in Gradle:
spoon { ... clearAppDataBeforeEachTest = true }
Set permissions into the Maniest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> ...
class PurchaseTests : BaseTest() {
companion object { @ClassRule @JvmField val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant( android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE ) } @Test fun userShouldAddItemToCart() { ... }
}
The --clear-app-data option added in #535 interferes with any permissions setup by Spoon such as read/write external storage or those granted through --grant-all. Since these permissions are not granted again after the
pm clear
command, functionality that you might reasonably expect to work (screenshots, code coverage, files) will no longer work unless granted again in some other way.