I faced an issue that is combined with UI testing of the view. I have an issue with an incorrect path to the element that is the text field, which is Search. I would like to achieve the state when the code for app.navigationBars will be resistant for different languages. That's why right now it looks the following way:
var airportsSearchTextField: XCUIElement { app.navigationBars["Airports"].searchFields["Search"] }
This won't work properly for another language like English. I know that it could be possible to add accessibilityIdentifier, but I'm not sure where and maybe for navigationBar is there any other way to implement a better solution to grab this element within UI tests?
func selectFlight() { airportsSearchTextField.tap() }