writing-espresso-tests
Installation
SKILL.md
Writing Espresso Tests — The Idle-Then-Act Model for Android Views
Espresso is the canonical instrumentation-time UI test framework for Android Views (not Compose — for Compose, use the compose/ skill set; for cross-Compose-View interop see ../../../compose/interop/testing-with-espresso-interop/SKILL.md). Each onView(...).perform(...).check(...) call internally pumps the main looper to idle, finds exactly one matching view, runs the action, and pumps to idle again before checking. This skill encodes the full matcher/action/assertion catalog, the RootMatchers.DEFAULT trap, and the per-version gotchas.
When to use this skill
- The user is testing an Activity, Fragment, or Dialog whose UI is built with Android Views (XML layouts, AppCompat, Material View components).
- A test fails with
NoMatchingViewException,AmbiguousViewMatcherException, orPerformException. - A click on an
AlertDialogbutton silently does nothing —RootMatchers.DEFAULTexcludes dialogs. - The user wants to stub
Intent.startActivityForResultfor camera, contacts, or share flows. - The user wants to register an
IdlingResourcefor a long-running task that Espresso can't see. - The user is debugging a
RecyclerViewinteraction. - The user mentions
BottomNavigationViewActionsand is surprised it isn't on the classpath in Espresso 3.7.0 contrib.