I'm really trying to wrap my head around unit testing. Could use a little help for a road block. I'm trying to click the location popup buttons when asking for location permissions. I'm using JUnit 4 and expresso. Here's my test rule:
@get:Rule
val testRule: ActivityTestRule<MyActivity> = ActivityTestRule(MyActivity::class.java)
I got a set up function:
@Before
fun setUp() {
mActivity = testRule.activity
mFragment = MyFragment.newInstance()
}
And finally my button click test:
@Test
fun testLocationClick(){
Assert.assertNotNull(onView(withId(R.id.button_turn_on_location)))
onView(withId(R.id.button_turn_on_location)).perform(click())
onView(withText("Allow all")).perform(click())
This last line saying "Allow all" was my attempt to try and click on the allow button but it does not work. Here's an attached image showing what I'm trying to click. Image
Aucun commentaire:
Enregistrer un commentaire