theapache64
09/13/2021, 10:49 AMassertIs[Not]Displayed
and assert[DoesNot]Exists
? 🤔Zach Klippenstein (he/him) [MOD]
09/13/2021, 7:05 PMassertIsNotDisplayed
can pass if a composable is present but not within screen bounds, or maybe clipped, and I think alpha 0? assertDoesNotExist
asserts if the composable doesn’t exist in the tree at all.theapache64
09/14/2021, 3:53 AMassertIsDisplayed
passing for that composable.
In other words, assertIsDisplayed
is working like “assertIfEverDisplayedInTheTree”. Is this also expected?Zach Klippenstein (he/him) [MOD]
09/14/2021, 5:38 AMtheapache64
09/14/2021, 6:40 AMassertIsDisplayed
and assertIsNotDisplayed
will be failed ? 🤔theapache64
09/14/2021, 7:00 AMclass SampleTest {
@get:Rule
val composeRule = createComposeRule()
@Test
fun test() {
// Setup content
val labelHideMe = "HIDE ME"
composeRule.setContent {
var isShow by remember {
mutableStateOf(true)
}
if(isShow){
Text(text = labelHideMe, modifier = Modifier.clickable {isShow = false })
}
}
composeRule.onNodeWithText(labelHideMe).performClick()
composeRule.onNodeWithText(labelHideMe).assertIsNotDisplayed() // ❌ this will fail
}
}
Zach Klippenstein (he/him) [MOD]
09/14/2021, 2:23 PM