This is how i set it in code:
let userBarButtonItem = UIBarButtonItem(image: userIcon,
style: .Plain,
target: self,
action: Selector("userButtonTapped:"))
userBarButtonItem.accessibilityIdentifier = "userBarButtonItem"
And then inside UITestCase
I need to find this using:
XCUIApplication().otherElements["userBarButtonItem"] //doesnt work, and the reason is:
Assertion Failure: UI Testing Failure - No matches found for "userBarButtonItem" Other
Is there a way how to find this for instance using predicate?