UITesting Identification of Element (Static Text/Label): Accessibility ID isn't ignored if blanked out

Originator:nicholasgmcconnell
Number:rdar://22683970 Date Originated:9/14/2015
Status:Open Resolved:
Product:Xcode 7 GM Product Version:
Classification: Reproducible:Yes
 
Summary:
Whats confusing with UITesting is how it identifies labels (StaticText).  If there is an accessibility ID, it uses that, otherwise you can use the actual text to identify.  e.g. app.staticTexts["Label"].  Whats confusing is you can't use both.  Once you start to use accessibility ID, there appears to be no way to test the text of the label.
The more obvious bug seems to the fact that once you add an accessibility ID and then decide to remove it, UI Testing seems to continue to identify based on accessibility ID and can't find the label by the label's text.  
Found a work-around:  Go into the XML of the storyboard and remove the XML for accessibility:<accessibility key="accessibilityConfiguration" identifier=""/>

Removing this row, then allows UI Testing to then find labels by label text again.  Very confusing.

Steps to Reproduce:
1. Create a new project with a storyboard scene that contains a label with the text "Label"
2. Create a UI Test.  app.staticTexts["Label"].exists is found.
2. Add an accessibility ID in the identity inspector for the label....eg "ID"
3. Create a UI Test:  app.staticTexts["ID"].exists is found, app.staticTexts["Label"].exists is not found.
4. Go back to the identity inspector for the label... remove the "ID" text.

Expected Results:
app.staticTexts["Label"] should be found

Actual Results:
app.staticTexts["Label"] is not found.
Have to remove the XML <accessibility key="accessibilityConfiguration" identifier=""/> in the storyboard source code to get this working.

Version:
iOS 7 GM

Notes:
Would also like to be able to find out the text of the label even if the accessibility ID has been set.  
app.staticTexts["ID"].value for example, does not get the text of the label.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!