Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

141
Vistas
Espresso fragment transaction testing

I am working on the project. I start learning instrumental tests using Espresso to write UI testing. I have a bottom view each bottom view tab has a parent fragment & their child fragments. I have done one wrong fragment transaction i.e when navigating toward home bottom view tab from services bottom view tab home is selected but showing services fragment.

I want to test when clicking on the home bottom view tab the home fragment is added or not. I have tried the code like this but it is passing on the wrong case as well

I have also go through the below StackOverflow posts but not working

Determine fragment change while espresso testing

How to test if a fragment is visible with Espresso

@Test
fun testHomeFragment_isDisplayed() {

    //click on home navigation button of bottom view
    onView(withId(R.id.navigation_home)).perform(click())

    //click on services navigation button of bottom view
    onView(withId(R.id.navigation_more)).perform(click())

    //click on recycler view item at given position
    onView(withId(R.id.more_rv)).perform(
            RecyclerViewActions.actionOnItemAtPosition<RecyclerView.ViewHolder>(
                    1,
                    MyViewAction.clickChildViewWithId(R.id.row_more_parent)));

    //Again click on home navigation button of bottom view
    onView(withId(R.id.navigation_home)).perform(click())

    //check that the home fragment is displayed or not.
    onView(allOf(withId(R.id.home_pager), withParent(withId(R.id.papa)))).
            check(matches(isCompletelyDisplayed()))

}

How to know which fragment is currently displayed on the screen?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda