Compare commits
1 Commits
b5817865e4
...
514c6b85c3
Author | SHA1 | Date | |
---|---|---|---|
514c6b85c3 |
@ -21,7 +21,7 @@ import androidx.test.uiautomator.UiDevice
|
|||||||
import androidx.test.uiautomator.UiSelector
|
import androidx.test.uiautomator.UiSelector
|
||||||
import org.hamcrest.CoreMatchers.allOf
|
import org.hamcrest.CoreMatchers.allOf
|
||||||
import org.hamcrest.Matchers.hasToString
|
import org.hamcrest.Matchers.hasToString
|
||||||
import org.junit.Before
|
import org.junit.BeforeClass
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
fun performLogin(someUrl: String? = null) {
|
fun performLogin(someUrl: String? = null) {
|
||||||
@ -128,6 +128,7 @@ fun testAddSourceWithUrl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
open class WithANRException {
|
open class WithANRException {
|
||||||
|
companion object {
|
||||||
// Running count of the number of Android Not Responding dialogues to prevent endless dismissal.
|
// Running count of the number of Android Not Responding dialogues to prevent endless dismissal.
|
||||||
private var anrCount = 0
|
private var anrCount = 0
|
||||||
|
|
||||||
@ -141,7 +142,15 @@ open class WithANRException {
|
|||||||
"Root:",
|
"Root:",
|
||||||
)
|
)
|
||||||
|
|
||||||
@Before
|
private fun handleAnrDialogue() {
|
||||||
|
val device = UiDevice.getInstance(getInstrumentation())
|
||||||
|
// If running the device in English Locale
|
||||||
|
val waitButton = device.findObject(UiSelector().textContains("wait"))
|
||||||
|
if (waitButton.exists()) waitButton.click()
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@BeforeClass
|
||||||
fun setUpHandler() {
|
fun setUpHandler() {
|
||||||
Espresso.setFailureHandler { error, viewMatcher ->
|
Espresso.setFailureHandler { error, viewMatcher ->
|
||||||
|
|
||||||
@ -153,11 +162,5 @@ open class WithANRException {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleAnrDialogue() {
|
|
||||||
val device = UiDevice.getInstance(getInstrumentation())
|
|
||||||
// If running the device in English Locale
|
|
||||||
val waitButton = device.findObject(UiSelector().textContains("wait"))
|
|
||||||
if (waitButton.exists()) waitButton.click()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user