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:
parent
67bf1626a0
commit
b056e779e0
2 changed files with 7 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
@ -66,7 +71,7 @@ class MarkdownTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun newMarkdownTest() {
|
||||
fun newMarkdownTest() {
|
||||
onView(withId(R.id.markdown_edit))
|
||||
.perform(typeText("# UI Testing\n\nThe quick brown fox jumped over the lazy dog."))
|
||||
openActionBarOverflowOrOptionsMenu(getApplicationContext())
|
||||
|
|
Loading…
Reference in a new issue