kif-framework / KIF

Keep It Functional - An iOS Functional Testing Framework
Other
6.21k stars 913 forks source link

tapView() not working on SwiftUI views in Xcode 12 with KIF 3.8.6 #1256

Closed jackrwright closed 2 years ago

jackrwright commented 2 years ago

We have some tests that utilize tapView(), but I found that that none of the taps succeed for SwiftUI views if I run the tests on xcode 12. They work fine if run on Xcode 13.

jackrwright commented 2 years ago

Specifically, tester().tapView(withAccessibilityIdentifier:) fails.

jackrwright commented 2 years ago

I was able to solve the issue by re-working my SwiftUI view, so it wasn't a KIF issue exclusively. The original view worked fine in the app and Xcode 13 tests, but seemed to be compiled by Xcode 12 in a way that was not compatible with how KIF

babbage commented 1 year ago

@jackrwright it would have been great to document here what you needed to change to make your view tappable. I am experiencing similar issues in Xcode 14.2, though tapping the items in these views has been failing since the change to SwiftUI, it isn't specific to that Xcode version. Still searching for what specific magic is required.... the view activates fine in the Accessibility Inspector.