testing-lazy-lists

Test Compose LazyColumn, LazyRow, and LazyVerticalGrid with scrolling and visibility assertions.

303|10|Updated May 15, 2026
One-click install
npx skills add https://github.com/skydoves/android-testing-skills --skill testing-lazy-lists
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: testing-lazy-lists
Source: https://github.com/skydoves/android-testing-skills/tree/main/compose/patterns/testing-lazy-lists
Command: npx skills add https://github.com/skydoves/android-testing-skills --skill testing-lazy-lists

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves flaky Compose UI tests for LazyColumn, LazyRow, and LazyVerticalGrid where off-screen items break naive assertions and scrolling by text.

Core Features & Use Cases

  • Semantic-first scrolling: Scroll by index or key using the list’s semantic actions, with test-tag disambiguation when multiple scrollables exist.
  • Correct visibility assertions: Use assertIsDisplayed instead of assertExists to avoid false positives from lazy composed or detached semantics.
  • Ground-truth verification: Read LazyListState.layoutInfo.visibleItemsInfo to confirm what is actually visible, including when animations reorder items.

Quick Start

Use testing-lazy-lists to reliably tag the Lazy container and items, scroll via performScrollToIndex or performScrollToKey, and assert on-screen items with assertIsDisplayed while validating visibility using state.layoutInfo.visibleItemsInfo.

Frequently Asked Questions about testing-lazy-lists

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why do my Jetpack Compose UI tests fail when scrolling to off-screen items in a LazyColumn?▼

Use assertIsDisplayed to verify lazy list items in Compose UI tests, because assertExists returns false positives from detached or lazily composed semantics. Ground-truth verification requires probing LazyListState.layoutInfo.visibleItemsInfo inside runOnIdle.

How do I scroll to a specific item in a LazyVerticalGrid during UI testing?▼

Scroll to specific items in LazyVerticalGrid tests by applying testTag to the container and stable tags to items, then using performScrollToKey or performScrollToIndex. If semantic actions fail, use a swipe fallback to navigate the list.

How do I test scrolling when multiple LazyRow scrollables exist on the same screen?▼

Disambiguate multiple LazyRow scrollables by applying a unique testTag to each container. This allows semantic scrolling actions like performScrollToKey to target the correct lazy layout without ambiguity during UI tests.

How do I verify visible items in a Compose lazy list when item placement animations reorder content?▼

Verify visible items during animations by reading LazyListState.layoutInfo.visibleItemsInfo inside runOnIdle. Optionally control mainClock.autoAdvance to manage animation frames and confirm what is actually displayed on screen.