Search code examples
ioscalabashcalabash-ios

Calabash iOS how to tap the back button item


Guys just cant figure out how to tap on BackButtonItem from Navigation Bar with Calabash framework, I'm setting accessibilityLabel like this:

self.navigationItem.leftBarButtonItem?.accessibilityLabel = "goBack"

and trying to test it like this with no luck:

touch("* marked:'goBack'")
touch_transition('navigationItemButtonView first',
                       "* marked:'#{goBack}'")

Solution

  • I'd recommend trying query "all * marked:'goBack'" and if that still doesn't return any results, just try a query "all *" and see if the label shows up in the results.

    You could also try setting the accessibilityIdentifier of the view - generally that's the preferred way to set up views for automation.