执行测试时是否可以断言 jetpack compose 节点是可滚动的?
class MyTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun givenEnoughItems_thenAssertListIsScrollable() {
composeTestRule.setContent {
BasicTheme {
ScrollableComponent(items = List(1000) { "$it" })
}
}
composeTestRule.onRoot().fetchSemanticsNode().assertIsScrollable()
}
}
fun SemanticsNodeInteraction.assertIsScrollable() : SemanticsNodeInteraction {
// What would go here?
}