I'm writing some UITests in XCode/Swift for an app. In this app I have a UITableView with some cells (off course) but for the tests, this tableview behaves as if it was empty.
print(XCUIApplication().descendantsMatchingType(.Any).matchingIdentifier("HelpContainer").tables.descendantsMatchingType(.Any).debugDescription)
I already added the accessibility identifiers but it's still empty as you can see in this log.
↪︎Find: Descendants matching type Any
Output: {
Image 0x7fd33c127630: traits: 8589934596, {{0.0, 64.0}, {375.0, 1.0}}
Image 0x7fd33ac37890: traits: 8589934596, {{0.0, 0.0}, {375.0, 64.0}}
Button 0x7fd33c40b780: traits: 8589934593, {{8.0, 26.0}, {54.0, 30.0}}, label: 'Cancel'
Button 0x7fd33c143b80: traits: 8724152321, {{8.0, 31.5}, {21.0, 21.0}}, label: 'Back'
StaticText 0x7fd33c1e67c0: traits: 8590000192, {{168.5, 29.0}, {38.5, 27.0}}, label: 'Help'
NavigationBar 0x7fd33ac0fd30: traits: 35192962023424, {{0.0, 20.0}, {375.0, 44.0}}, identifier: 'Help'
Other 0x7fd33ac39370: traits: 8589934592
Table 0x7fd33c144b00: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
Other 0x7fd33c1e7570: traits: 8589934592
Other 0x7fd33ac38b40: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}, identifier: 'HelpContainer'
Other 0x7fd33ac383c0: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
Other 0x7fd33ac37c40: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
Other 0x7fd33ac26240: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
Other 0x7fd33ac25fb0: {{0.0, 0.0}, {375.0, 667.0}}
Window 0x7fd33ac2bdb0: Main Window, {{0.0, 0.0}, {375.0, 667.0}}
Other 0x7fd33ac39b30: traits: 8589934592
Other 0x7fd33c1e6f80: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
Window 0x7fd33c1e78c0: {{0.0, 0.0}, {375.0, 667.0}}
Other 0x7fd33ac3b1b0: {{0.0, 0.0}, {375.0, 20.0}}
Other 0x7fd33c1450a0: traits: 8388608, {{6.0, 0.0}, {54.0, 20.0}}
Other 0x7fd33c121790: traits: 8388608, {{65.0, 0.0}, {13.0, 20.0}}, label: '3 of 3 Wi-Fi bars', value: SSID
Other 0x7fd33ac3b4d0: traits: 8389120, {{163.0, 0.0}, {52.0, 20.0}}, label: '11:12 AM'
Other 0x7fd33ac3bc60: traits: 8388608, {{345.0, 0.0}, {25.0, 20.0}}, label: '-100 % battery power'
Other 0x7fd33ad671b0: {{0.0, 0.0}, {375.0, 20.0}}
StatusBar 0x7fd33ac3aa40: {{0.0, 0.0}, {375.0, 20.0}}
Window 0x7fd33ac3a2c0: {{0.0, 0.0}, {375.0, 667.0}}
}
↪︎Find: Elements matching predicate '"HelpContainer" IN identifiers'
Output: {
Other 0x7fd33ac38b40: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}, identifier: 'HelpContainer'
}
↪︎Find: Descendants matching type Table
Output: {
Table 0x7fd33c144b00: traits: 8589934592, {{0.0, 0.0}, {375.0, 667.0}}
}
↪︎Find: Descendants matching type Any
"HelpContainer" is the identifier of the view that contains the UITableView, as you can see the table view itself is there but afterwards, nothing. Does anybody knows what should be done to fix this?
Thanks in advance :)
PS I used XCode accessibility inspector and the result was basically the same