The app on which I am working has it's ui tested using Appium. Because of this, I set accessibility identifiers on views.
struct RootView: View {
var body: some View {
VStack {
Text("some text")
Text("more text")
}
// wrapper 1
.accessibilityElement(children: .contain)
.accessibilityIdentifier("ID 1111111111111")
// wrapper 2
.accessibilityElement(children: .contain)
.accessibilityIdentifier("ID 2222222222222")
}
}
(the code is oversimplified to ease the understanding of the problem)
Running the code above on iOS 14 would output this on Appium Inspector when inspecting the views:
<XCUIElementTypeOther type="XCUIElementTypeOther" name="ID 2222222222222" enabled="true" visible="true" accessible="false" x="157" y="408" width="76" height="41" index="0">
<XCUIElementTypeOther type="XCUIElementTypeOther" name="ID 1111111111111" enabled="true" visible="true" accessible="false" x="157" y="408" width="76" height="41" index="0">
<XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="some text" name="some text" label="some text" enabled="true" visible="true" accessible="true" x="157" y="408" width="76" height="21" index="0"/>
<XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="more text" name="more text" label="more text" enabled="true" visible="true" accessible="true" x="159" y="428" width="73" height="21" index="1"/>
</XCUIElementTypeOther>
</XCUIElementTypeOther>
So each group of accessibilityElement and accessibilityIdentifier would create a XCUIElementTypeOther with the same name property as the id set by accessibilityIdentifier.
With iOS 15/16 these are not working anymore, here is the output on Appium Inspector when inspecting the views:
<XCUIElementTypeOther type="XCUIElementTypeOther" name="ID 2222222222222" enabled="true" visible="true" accessible="false" x="157" y="408" width="76" height="41" index="0">
<XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="some text" name="some text" label="some text" enabled="true" visible="true" accessible="true" x="157" y="408" width="76" height="21" index="0"/>
<XCUIElementTypeStaticText type="XCUIElementTypeStaticText" value="more text" name="more text" label="more text" enabled="true" visible="true" accessible="true" x="158" y="428" width="74" height="21" index="1"/>
</XCUIElementTypeOther>
It looks like the first group of accessibilityElement and accessibilityIdentifier is no longer generating an XCUIElementTypeOther.
Is there a way to have the same output of iOS 14 on iOS 15/16?