How to interact with MKMapView subview in UI Test

When I normally write UI Tests, I query for a button by using

app.buttons["accessibilityIdentifier"].firstMatch


However, when I want to do the same for a similar button that is on screen, I cannot get it to work. This button is inside of a simple UIView container that is added to an MKMapView by using

map.addSubView(popupWithButtonView)


How would I interact with this buton in my UI Test?


I have tried the following, without success:

app.buttons["trueButton"].firstMatch
app.maps.element.buttons["trueButton"].firstMatch
app.maps.buttons["trueButton"].firstMatch


The accessibilityIdentifier is set correctly, as when the popup normally occurs when debugging, I can see it with the 'Debug View Hiearchy' tool.


Any idea what the right way is to query for this button?

Answered by Svantulden in 261643022

Filed Radar, in case this is a bug: 34544764

Accepted Answer

Filed Radar, in case this is a bug: 34544764

How to interact with MKMapView subview in UI Test
 
 
Q