java.lang.IllegalStateException: No compose hierarchies found in the app.
Possible reasons include:
(1) the Activity that calls setContent did not launch;
(2) setContent was not called;
(3) setContent was called before the ComposeTestRule ran. If setContent is called by the Activity, make sure the Activity is launched after the ComposeTestRule runs
it happens very often on API 33, have also seen it on API 26 but much rarely.
Environment
The setup in which the bug is reproducible:
Device or Emulator: Emulator
API level: Mainly API 33, rarely API 26.
AndroidUiTestingUtils version: 1.2.2 (could not run on API 33 before)
Affected Component: Composable
Expected behavior
The test runs normally without throwing an exception
Additional context
Might have to do with the fix on 1.2.2 to run tests on API 33, adding androidTestImplementation("androidx.test:core:1.5.0-beta01")
Might be a compatibility problem between createEmptyComposeRule() and ActivityScenario? Check solution here
Another option would be not to use createEmptyComposeRule() at all and use a bitmap for comparing the screenshot instead
Describe the bug
it happens very often on API 33, have also seen it on API 26 but much rarely.
Environment The setup in which the bug is reproducible:
Expected behavior The test runs normally without throwing an exception
Additional context
androidTestImplementation("androidx.test:core:1.5.0-beta01")
createEmptyComposeRule()
andActivityScenario
? Check solution here Another option would be not to use createEmptyComposeRule() at all and use a bitmap for comparing the screenshot instead