testing-lazy-lists

Installation
SKILL.md

Testing Lazy Lists — Tag the Container, Scroll by Semantics, Probe layoutInfo

LazyColumn / LazyRow / LazyVerticalGrid only compose items that are or were near the viewport. That breaks the naive "find by text and assert" flow because off-screen items may not exist, may exist as detached semantic nodes, or may exist with wrong bounds. This skill encodes the patterns androidx itself uses — tag the container, scroll via the semantic action or via testTag + a swipe gesture, verify with assertIsDisplayed, and read LazyListState.layoutInfo for ground truth.

When to use this skill

  • The developer is writing a test for any Lazy* composable (LazyColumn, LazyRow, LazyVerticalGrid, LazyHorizontalGrid, LazyVerticalStaggeredGrid).
  • A test asserts an item is "present" but the developer cannot tell whether it is on-screen.
  • The developer wants to programmatically scroll to index 7, key "key_10", or by an offset.
  • A test asserts on a per-item index/offset and needs the canonical state.layoutInfo shape.
  • The developer is testing Modifier.animateItem() or any item placement animation.
  • A reviewer asks why assertExists is wrong for a lazy item.

When NOT to use this skill

  • The list under test is a non-lazy Column/Row/FlowRow. Use ../structuring-a-compose-test/SKILL.md plus ../../assertions/asserting-node-state-and-text/SKILL.md.
  • The class skeleton itself is wrong; fix ../structuring-a-compose-test/SKILL.md first.
  • The scroll action is a custom Modifier.scrollable (not LazyListState-backed); use ../../actions/injecting-touch-gestures/SKILL.md.
  • The test is for animation timing; layer ../../synchronization/testing-animations-deterministically/SKILL.md.
Installs
35
GitHub Stars
319
First Seen
May 16, 2026
testing-lazy-lists — skydoves/android-testing-skills