Skip to content

Instantly share code, notes, and snippets.

@LethalMaus
Created March 13, 2026 20:11
Show Gist options
  • Select an option

  • Save LethalMaus/a2b0e094985a6ed9d168c74071c56bf8 to your computer and use it in GitHub Desktop.

Select an option

Save LethalMaus/a2b0e094985a6ed9d168c74071c56bf8 to your computer and use it in GitHub Desktop.
Recomposition overlay test snippet for Android app startup article
@RunWith(AndroidJUnit4::class)
class MainScreenRecompositionOverlayTest {
@get:Rule
val composeRule = createAndroidComposeRule<ComponentActivity>()
@Test
fun overlay_expandShowsCounters_and_clearResetsRows() {
assumeTrue(BuildConfig.DEBUG)
composeRule.setContent {
MainScreen(viewModel = MainViewModel())
}
composeRule.onNodeWithText("Recompose show").performClick()
composeRule.onNodeWithText("Clear").performClick()
composeRule.onAllNodesWithText("TopBar:", substring = true).assertCountEquals(0)
composeRule.onAllNodesWithText("ConnectivitySection:", substring = true).assertCountEquals(0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment