KakaoCup / Compose

Nice and simple DSL for Espresso Compose UI testing in Kotlin
https://kakaocup.github.io/Compose/
Apache License 2.0
139 stars 13 forks source link

Modify ViewBuilder node collection to take into account nested children and useUnmergedTree param #15

Closed FrangSierra closed 2 years ago

FrangSierra commented 2 years ago

Resolves #14

This PR includes support for useUnmergedTree over the nodes inside the ComposeTestRule. I have made some minor changes over the constructors of KNode, and ViewBuilder to include this parameter. However the current implementation using composeTestRule.onRoot(useUnmergedTree).onChildren() was only returning the children of the root and not the nested ones. No matter if useUnmergedTree was used or not.

I think that the onChildren() method from Compose should take this into account but it's not doing it. The fix I have included makes use of the onAllNodes() method with a custom SemanticMatcher that takes any node inside it. I have looked into the onChildren() implementation together with how the framework looks for the children on the nodes, but I have not found a better solution. If you find other way to do it, please let me know or suggest a change on the PR!

Thank you so much!

braindonor commented 2 years ago

I have tested this PR and can confirm that it fixes #14

Many thanks.

Vacxe commented 2 years ago

@FrangSierra thanks for the contribution. I changed a bit logic with node matching to avoid node filtering from root. Also your commit has been cherry-picked to #16 please take a look if you have a free time mate

@braindonor Thanks for the issue reporting, thats very important for us to have a feedback. Especially on the beginning. Cheers. I will prepare a next release on next weekend. Thats works for you?

FrangSierra commented 2 years ago

Hello @Vacxe ! Thanks for take the time to check the PR. I just saw the changes and I totally agree with them. I though about make use of onNode too because the any filter on the root was anything but elegant 🙈 . However I was afraid to modify the ViewBuilder class to much being my first contribution 😅

Just reviewed and approved the PR! Will close this PR(or feel free to do it) after yours is merged!

Thank you so much! Looking forward to see how the library grows and contribute in whatever I can!

Vacxe commented 2 years ago

@FrangSierra just in case don't be afraid next time mate. We all in the same boat named OSS.

braindonor commented 2 years ago

Weekend release would be great.

Thanks to both of you for your work on this.

On 19. Oct 2021, at 10.02, Konstantin Aksenov @.***> wrote:

 @FrangSierra thanks for the contribution. I changed a bit logic with node matching to avoid node filtering from root. Also your commit has been cherry-picked to #16 please take a look if you have a free time mate

@braindonor Thanks for the issue reporting, thats very important for us to have a feedback. Especially on the beginning. Cheers. I will prepare a next release on next weekend. Thats works for you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Vacxe commented 2 years ago

Close with #17