Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with SwiftUI Lists? #15

Open
andyj-at-aspin opened this issue Jul 21, 2021 · 2 comments
Open

Working with SwiftUI Lists? #15

andyj-at-aspin opened this issue Jul 21, 2021 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@andyj-at-aspin
Copy link

I wonder if you ever got Hammer to work with SwiftUI Lists. We've played around with the .accessibiliy(identifier:) View modifier and that has worked for creating UI Tests within Xcode, however when we tried to locate the Lists with Hammer we seem to have found that no UIViews in the view hierarchy are given the accessibility identifiers we gave to the List Views.

Just to move forward, I've used the .accessibility(label:) view modifier as well and written an extension on UIView which recursively hunts all subviews for the first UIView matching a given test and tested the UIView.accessibilityLabel instead. At least once the UIView is identified we can then use it with Hammer.

Have you folks tried hunting SwiftUI-built objects much and had you found Lists don't play nicely?

@gabriellanata
Copy link
Contributor

I actually haven't tested Hammer using Hammer with SwiftUI at all! I'm glad to hear it's working but I don't know why the identifier would not work when the label does

@gabriellanata
Copy link
Contributor

gabriellanata commented Jul 22, 2021

Adding initial SwiftUI support here: #19 Let me know if this matches what you were doing. I did verify finding a view by its identifier doesn't really work. I checked the view hierarchy and there doesn't seem to show all the subviews though, but maybe I'm looking in the wrong place. Can you share your accessibility label method?

@gabriellanata gabriellanata added the enhancement New feature or request label Jul 22, 2021
@gabriellanata gabriellanata added this to the SwiftUI milestone Jul 22, 2021
@gabriellanata gabriellanata added the help wanted Extra attention is needed label Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants