Accessibility Nodes Retain View Models When Running UI Tests

Number:rdar://FB9188594 Date Originated:2021-06-17
Status:Open Resolved:
Product:Xcode Product Version:12.5
Classification:Incorrect/Unexpected Behavior Reproducible:Yes
Please describe the issue:
We want to be able to assert that all of our objects were deallocated as expected after running our ui tests. However, we see that there are accessibility nodes that reference our view models and prevent that from happening only when running ui tests. When doing it manually through our ui we do not see the accessibility nodes retaining our view models, which is why we think it might be a bug on Apple's side.

Please list the steps you took to reproduce the issue:
1. Run any UI test
2. Set breakpoint at the end of the test
3. Look at memory and object graph and see view models being retained

What did you expect to happen?
Objects should be released and we should be able to assert that they were deallocated.

What actually happened?
View models are retained and we are unable to assert that they were deallocated.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at 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!