Skip to content

Instantly share code, notes, and snippets.

@canergulgec
Last active January 26, 2021 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canergulgec/5d57c38e35eb537f832b60b4f463e476 to your computer and use it in GitHub Desktop.
Save canergulgec/5d57c38e35eb537f832b60b4f463e476 to your computer and use it in GitHub Desktop.
@LargeTest
class MovieFragmentTest {
private lateinit var activityScenario: ActivityScenario<MainActivity>
private val mockWebServer = MockWebServer()
@Before
fun setup() {
mockWebServer.start(port)
IdlingRegistry.getInstance().register(
OkHttp3IdlingResource.create(
"okhttp",
OkHttpProvider.getOkHttpClient()
)
)
activityScenario = ActivityScenario.launch(MainActivity::class.java)
}
@Test
fun recyclerview_second_item_should_be_visible() {
mockWebServer.dispatcher = dispatcherWithCustomBody()
onScreen<MovieScreen> {
recycler {
childAt<MovieScreen.Item>(2) {
name { isVisible() }
}
}
}
}
@After
fun cleanup() {
mockWebServer.close()
activityScenario.close()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment