Sivan
12/25/2022, 7:55 AMprivate val restorationTester = StateRestorationTester(composeTestRule)
Adding a StateRestorationTester
was the missing link. Notes from the doc 👇
Instead of calling ComposeContentTestRule.setContent you need to use setContent on this object, then change your state so there is some change to be restored, then execute emulateSavedInstanceStateRestore and assert your state is restored properly.
Example :
composeTestRule.onNodeWithTag(dismissButtonTag).performClick()
emulateSavedInstanceStateRestore()
assert(!sheetState.isVisible)
This works and the test passes 🙂 Thanks folks!