So I have a situation in which I have a few textFields that are validated. I'm trying to run a UI test, and when they fail they will get an alert to pop up with an error message (potentially a different message depending on what fields are invalid and in what way).
I'd like to test that not only that an alert appeared, but that the correct message is displayed. The problem I'm having is that I need to get the localized text for comparison (if I run tests in another language other than english), but when I call NSLocalizedString in the UITest it can't gather the correct localized string (just returns the key [default])
I've tried adding the localizeable.strings
files to the UITest target, but to no avail. Does anyone know if this is possible?
edit as a side note: I also tried setting an accessibility identifier on the UIAlertView
but when I query with that accessibility identifier it doesn't exist, I can only query it using the title of the alert which seems backwards.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…