I just upgraded to compose `2023.08.00` and one of...
# compose-android
d
I just upgraded to compose
2023.08.00
and one of my compose ui tests is behaving very oddly and is failing where it wasn't before the upgrade. I have a composable which contains a LazyVerticalGrid, with which I have added test tags to the items within it. In my test, I first set the number of items to be 3 and validate that there are 3 items with that test tag. I then update items list to a single item. However,
.onAllNodesWithTag("ServiceCard")
returns 3 items still. What is odd is that in the emulator, when I set a breakpoint right before I get those nodes, I can see only a single item/card visible. I've tried calling
awaitIdle
in case there was some work that needed to happen under the hood, but that didn't help. Any idea what might have changed to cause this? And is this the new expected behavior?
👀 3
s
Could you isolate it into snippet? Please file a bug if you do 🙂
d
Thanks for your response Andrei. Here is a minimal project reproducing the issue
You can reproduce the issue in ExampleInstrumentedTest. It should fail on line 54. If you set breakpoints on lines 47 and 53 and debug the test, you will see 4 items in the grid on the first breakpoint, and 1 on the second breakpoint.
Also, please ignore the weird initialization of the list of names in the test. Autocomplete failed successfully:
Copy code
var names by mutableStateOf(
    listOf(
        "" +
            "Bob",
        "John",
        "Billy",
        "Jean",
    )
)
s
Please file a bug on Compose tracker :)
d
s
thanks for reporting it there! I hoped it was a test infra issue, but it was reassigned to me regardless 😄 I replied to you on the bug, you want to filter if the node is placed to make sure you don't assert on deactivated nodes.
d
Got it. So, this was a behavioral change that was introduced recently?
s
technically, it is a bug fix, we didn't recycle nodes correctly when items were removed
👍 1
you might encounter similar things if you scroll in ui test, the list will contain nodes that are technically not on screen