First of all yes I have seen this so question but there is currently no answer.
The root problem is that I am currently XCUITesting
my app which is localized so the UIAlertAction
s are localized so I can't find the button.
I could do a hack wherein I'll include all the Localizable.strings
on my UITesting bundle then get the localized version when trying to fetch the button like this.
let localizedAlertTitle = ...(some function to fetch localized name)
let localizedButtonName = ...(some function to fetch localized name)
self.app
.alerts[localizedAlertTitle]
.buttons[localizedButtonName]
.tap()
Another way is to probably do the hack said by this so answer but it's too hacky and has boilerplate.
Is there a way to set the accessibilityIdentifier
on a UIAlertAction?