Grant WRITE_EXTERNAL_STORAGE permission for UI tests

The absence of this was causing the tests to fail on Firebase.
This commit is contained in:
William Brawner 2021-02-20 22:23:58 -07:00
parent 67bf1626a0
commit b056e779e0
2 changed files with 7 additions and 1 deletions

View file

@ -44,6 +44,7 @@ android {
versionCode 32
versionName "0.8.10"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'
buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false"
}
signingConfigs {

View file

@ -1,5 +1,6 @@
package com.wbrawner.simplemarkdown
import android.Manifest.permission.WRITE_EXTERNAL_STORAGE
import android.app.Activity.RESULT_OK
import android.app.Instrumentation
import android.content.Context
@ -22,6 +23,7 @@ import androidx.test.espresso.web.webdriver.DriverAtoms.findElement
import androidx.test.espresso.web.webdriver.DriverAtoms.getText
import androidx.test.espresso.web.webdriver.Locator
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import androidx.test.rule.GrantPermissionRule
import com.wbrawner.simplemarkdown.view.activity.MainActivity
import org.hamcrest.Matchers.containsString
import org.junit.Assert.assertEquals
@ -36,6 +38,9 @@ class MarkdownTests {
@get:Rule
var activityRule = IntentsTestRule(MainActivity::class.java, false, false)
@get:Rule
val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(WRITE_EXTERNAL_STORAGE)
lateinit var file: File
@Before