26 lines
749 B
Plaintext
26 lines
749 B
Plaintext
When writing UI tests, it is often required to access the UI object to assess its behavior is as expected. One can do it by name, placeholder, or some other property that can be localized. The "localized property" way is not reliable as it can change according to the language of the user.
|
|
|
|
In order to avoid to have to often update the UI tests (when the name, placeholder, ... is changing) it's more convenient to refer to it through an "accessibilityIdentifier".
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,text]
|
|
----
|
|
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,text]
|
|
----
|
|
|
|
----
|
|
|
|
|
|
== See
|
|
|
|
* https://www.swiftbysundell.com/posts/getting-started-with-xcode-ui-testing-in-swift[Getting started with Xcode UI testing in Swift - Verifying state in a UI test]
|
|
|