UI Tests Failing on iOS because button not found

Please describe the question in detail and share your code, configuration, and other relevant info.

I am trying to use Fastlane Snapshot to create screenshots of my Ionic app. Unfortunately the UI Tests often fail in Xcode because a button cannot be found.

For example…

webViewsQuery.buttons[“Meal Plans”].tap()

This is a tab button on the bottom nav of the Ionic app. Is there any kind of best practice for naming buttons or tab buttons so that they can always be found when the tests are running?

Generating screenshots is really painful and I’d like to get this working. Thank you for any help.