Вот мой метод тестирования, и мой тест не пройден с этим сообщением androidx.test.espresso.AppNotIdleException: зацикливается на 3479 итерациях в течение 60 СЕКУНД.Следующие условия простоя не выполнены. В чем проблема провала теста?и это терпит неудачу в этой строке .perform (RecyclerViewActions.scrollToPosition (0))
@Rule
@JvmField
val activityRule = IntentsTestRule(SingleFragmentActivity::class.java)
@Rule
@JvmField
val taskExecutorRule = InstantTaskExecutorRule()
@Rule
@JvmField
val dataBindingIdlingResourceRule = DataBindingIdlingResourceRule(activityRule)
@Before
fun setup() {
aboutFragment = AboutFragment()
val bundle = Bundle()
bundle.putParcelable(AboutFragment.ITEM_ARGUMENT, asItemById())
aboutFragment.arguments = bundle
activityRule.activity.setFragment(aboutFragment)
}
val itemElementText = getApplicationContext<Context>().resources.getString(
R.string.label_about)
onView(ViewMatchers.withId(R.id.store_list))
.perform(RecyclerViewActions.scrollToPosition<RecyclerView.ViewHolder>(0))
onView(withId(R.id.title_about_store)).check(matches(withText(itemElementText)))
class AboutFragment : Fragment() {
private lateinit var aboutAdapter: AboutAdapter
private lateinit var binding: FragmentAboutBinding
private val viewModel: AboutViewModel by lazyViewModel()
private var store: DB.Item? = null
override fun onAttach(context: Context) {
AndroidSupportInjection.inject(this)
super.onAttach(context)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
item = arguments?.getParcelable(ITEM_ARGUMENT)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initList()
item?.let {
aboutAdapter.display(it)
}
}