Tasks screen val ac=vityScenario = Ac=vityScenario.launch(TasksAc=vity::class.java) dataBindingIdlingResource.monitorAc=vity(ac=vityScenario) // Click on the "+" bu\on, add details, and save onView(withId(R.id.fab_add_task)).perform(click()) onView(withId(R.id.add_task_=tle)).perform(typeText("=tle")) onView(withId(R.id.add_task_descrip=on)).perform(typeText("descrip=on")) onView(withId(R.id.fab_save_task)).perform(click()) // Then verify task is displayed on screen onView(withText("=tle")).check(matches(isDisplayed())) }
Tasks screen val ac=vityScenario = Ac=vityScenario.launch(TasksAc=vity::class.java) dataBindingIdlingResource.monitorAc=vity(ac=vityScenario) // Click on the "+" bu\on, add details, and save onView(withId(R.id.fab_add_task)).perform(click()) onView(withId(R.id.add_task_=tle)).perform(typeText("=tle")) onView(withId(R.id.add_task_descrip=on)).perform(typeText("descrip=on")) onView(withId(R.id.fab_save_task)).perform(click()) // Then verify task is displayed on screen onView(withText("=tle")).check(matches(isDisplayed())) } Ac=vityΛىಈ͠ ෳͷFragmentʹ·͕ͨͬͯ ϑϩʔΛݕূ
- Valid =tle and descrip=on combina=on and click save onView(withId(R.id.add_task_=tle)).perform(replaceText("=tle")) onView(withId(R.id.add_task_descrip=on)).perform(replaceText("descrip=on")) onView(withId(R.id.fab_save_task)).perform(click()) .. }
- Verify that the repository saved the task val tasks = (repository.getTasksBlocking(true) as Result.Success).data assertEquals(tasks.size, 1) assertEquals(tasks[0].=tle, "=tle") verify(navController).navigate( AddEditTaskFragmentDirec=ons .ac=onAddEditTaskFragmentToTasksFragment(ADD_EDIT_RESULT_OK)) } Fake͔ΒσʔλΛ औಘͯ͠ݕূ
- Verify that the repository saved the task val tasks = (repository.getTasksBlocking(true) as Result.Success).data assertEquals(tasks.size, 1) assertEquals(tasks[0].=tle, "=tle") verify(navController).navigate( AddEditTaskFragmentDirec=ons .ac=onAddEditTaskFragmentToTasksFragment(ADD_EDIT_RESULT_OK)) } ਖ਼͍͠ύϥϝʔλͰNaviga=on Ͱ͖͍ͯΔ͔ݕূ