title: androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching
body: <p>I'm trying to test my fragment with Espresso. No matter what view I'm trying to test I get <code>NoMatchingViewException</code>, I'm 100% sure that the view actually exists on the fragment.
  This is my test:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>@LargeTest
  @ExperimentalCoroutinesApi
  @RunWith(AndroidJUnit4::class)
  class ExploreFragmentTest {
      private lateinit var blogRepository: FakeBlogRepository
      private lateinit var inAppMessagesRepository: FakeInAppMessageRepository
      private lateinit var fakeFarRetailsRepository: FakeFarRetailsRepository
      private lateinit var fakeUserProfileRepository: FakeUserProfileRepository
  
      @Before
      fun initRepository() {
          blogRepository = FakeBlogRepository()
          inAppMessagesRepository = FakeInAppMessageRepository()
          fakeFarRetailsRepository = FakeFarRetailsRepository()
          fakeUserProfileRepository = FakeUserProfileRepository()
  
          ServiceLocator.blogRepository = blogRepository
          ServiceLocator.inAppMessagesRepository = inAppMessagesRepository
          ServiceLocator.userProfileRepository = fakeUserProfileRepository
      }
  
      @Test
      fun noRetailsNearby_displaysNoRetailsNearbyLayout() = runBlockingTest {
          // GIVEN - A fake repository with far retails
          ServiceLocator.retailsRepository = fakeFarRetailsRepository
          // WHEN - ExploreFragment launched to display retails
          launchFragmentInContainer&lt;ExploreFragment&gt;(null, R.style.AppTheme)
          // THEN - No retails layout is displayed on the screen
          onView(withId(R.id.clExploreContainer)).check(matches(isDisplayed()))
      }
  }
  </code></pre>
  
  <p>This is the layout of the related fragment:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@id/clExploreContainer"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
      &lt;com.google.android.material.appbar.AppBarLayout
              android:id="@+id/ablExplore"
              android:layout_width="match_parent"
              android:layout_height="@dimen/toolbar_height"
              android:background="@android:color/transparent"
              android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"&gt;
  
          &lt;com.google.android.material.appbar.CollapsingToolbarLayout
                  android:id="@+id/ctlExploreHeader"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:fitsSystemWindows="true"
                  app:contentScrim="?attr/colorPrimary"
                  app:layout_scrollFlags="scroll|exitUntilCollapsed"
                  app:statusBarScrim="@android:color/transparent"
                  app:toolbarId="@+id/tbExplore"&gt;
  
              &lt;ImageView
                      android:id="@+id/ivHeaderLemon"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:background="@color/colorPrimary"
                      android:scaleType="centerCrop"
                      android:src="@drawable/bg_main"
                      app:layout_collapseMode="parallax" /&gt;
  
              &lt;androidx.appcompat.widget.Toolbar
                      android:id="@+id/tbExplore"
                      android:layout_width="match_parent"
                      android:layout_height="@dimen/collapsed_toolbar_height"
                      app:layout_collapseMode="pin"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toTopOf="parent" /&gt;
  
              &lt;androidx.constraintlayout.widget.ConstraintLayout
                      android:id="@+id/collapsing_logo"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_gravity="bottom"
                      android:layout_marginStart="20dp"
                      android:minHeight="?attr/actionBarSize"&gt;
  
                  &lt;ImageView
                          android:id="@+id/ivLogo"
                          android:layout_width="@dimen/toolbar_logo_width"
                          android:layout_height="@dimen/toolbar_logo_height"
                          android:adjustViewBounds="true"
                          android:scaleType="fitStart"
                          android:src="@drawable/myfoody_logo"
                          app:layout_constraintBottom_toBottomOf="parent"
                          app:layout_constraintStart_toStartOf="parent"
                          app:layout_constraintTop_toTopOf="parent" /&gt;
              &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
          &lt;/com.google.android.material.appbar.CollapsingToolbarLayout&gt;
      &lt;/com.google.android.material.appbar.AppBarLayout&gt;
  
      &lt;androidx.core.widget.NestedScrollView
              android:id="@+id/svExplore"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              app:layout_behavior="@string/appbar_scrolling_view_behavior"
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent"
              app:layout_constraintTop_toTopOf="parent"&gt;
  
          &lt;androidx.constraintlayout.widget.ConstraintLayout
                  android:id="@+id/clExploreContainer"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"&gt;
  
              &lt;include
                      android:id="@+id/miniInAppMessageLayout"
                      layout="@layout/mini_in_app_message_layout"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:visibility="gone"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintHorizontal_bias="0.0"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toTopOf="parent"
                      tools:visibility="visible" /&gt;
  
              &lt;include
                      android:id="@+id/tutorialLayout"
                      layout="@layout/tutorial_layout"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginStart="20dp"
                      android:layout_marginTop="32dp"
                      android:layout_marginEnd="20dp"
                      android:visibility="gone"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@id/miniInAppMessageLayout"
                      tools:visibility="visible" /&gt;
  
              &lt;include
                      android:id="@+id/nearToMeLayout"
                      layout="@layout/near_to_me_layout"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/tutorialLayout" /&gt;
  
              &lt;include
                      android:id="@+id/favouritesLayout"
                      layout="@layout/favourites_layout"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/section_explore_margin_top"
                      android:visibility="gone"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/nearToMeLayout"
                      tools:visibility="visible" /&gt;
  
              &lt;androidx.fragment.app.FragmentContainerView
                      android:id="@+id/flCompanyMessageFragment"
                      android:name="com.anagramma.myfoody.fragments.explore.blog.RecipesFragment"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/section_explore_margin_top"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/favouritesLayout" /&gt;
  
              &lt;androidx.constraintlayout.widget.ConstraintLayout
                      android:id="@+id/clRemoteMessagesContainer"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@id/flCompanyMessageFragment"&gt;
  
                  &lt;include
                          android:id="@+id/rcmlExplore"
                          layout="@layout/remote_config_message_layout_explore"
                          android:layout_width="0dp"
                          android:layout_height="wrap_content"
                          android:visibility="gone"
                          app:layout_constraintEnd_toEndOf="parent"
                          app:layout_constraintStart_toStartOf="parent"
                          app:layout_constraintTop_toTopOf="parent"
                          tools:visibility="visible" /&gt;
  
                  &lt;include
                          android:id="@+id/lMeetMyBrandBannerExplore"
                          layout="@layout/meet_my_brand_banner"
                          android:layout_width="0dp"
                          android:layout_height="wrap_content"
                          android:layout_marginTop="@dimen/section_explore_margin_top"
                          android:visibility="gone"
                          app:layout_constraintEnd_toEndOf="parent"
                          app:layout_constraintStart_toStartOf="parent"
                          app:layout_constraintTop_toTopOf="parent" /&gt;
  
              &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
              &lt;androidx.fragment.app.FragmentContainerView
                      android:id="@+id/flLastArticles"
                      android:name="com.anagramma.myfoody.fragments.explore.blog.LastArticlesFragment"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/section_explore_margin_top"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/clRemoteMessagesContainer"
                      tools:layout="@layout/fragment_explore_blog_section" /&gt;
  
              &lt;androidx.fragment.app.FragmentContainerView
                      android:id="@+id/flLiveSustainable"
                      android:name="com.anagramma.myfoody.fragments.explore.blog.LiveSustainableFragment"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/section_explore_margin_top"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/flLastArticles"
                      tools:layout="@layout/fragment_explore_blog_section" /&gt;
  
              &lt;androidx.fragment.app.FragmentContainerView
                      android:id="@+id/flMyFoodyWorld"
                      android:name="com.anagramma.myfoody.fragments.explore.blog.MyFoodyWorldFragment"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/section_explore_margin_top"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/flLiveSustainable"
                      tools:layout="@layout/fragment_explore_blog_section" /&gt;
  
              &lt;androidx.fragment.app.FragmentContainerView
                      android:id="@+id/fAutoProduction"
                      android:name="com.anagramma.myfoody.fragments.explore.blog.AutoproductionFragment"
                      android:layout_width="0dp"
                      android:layout_height="wrap_content"
                      android:layout_marginTop="@dimen/section_explore_margin_top"
                      app:layout_constraintEnd_toEndOf="parent"
                      app:layout_constraintStart_toStartOf="parent"
                      app:layout_constraintTop_toBottomOf="@+id/flMyFoodyWorld"
                      tools:layout="@layout/fragment_explore_blog_section" /&gt;
  
          &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  
      &lt;/androidx.core.widget.NestedScrollView&gt;
  &lt;/androidx.coordinatorlayout.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>Every time I run the test I get this error: <code>androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: com.anagramma.myfoody.staging:id/clExploreContainer</code>, can't understand why. Am I missing something related to espresso framework?</p>