I've a table with multiple sections. Each section has a custom footer view, with a button inside. From the UITests, I can't manage to make the automated process press the button.
I've tried manually writing the tap() action and also tried by recording the test in Xcode, without any luck.
What I've been trying:
isAccessibilityElement = true/false
accessibilityIdentifier = ...
accessibilityLabel = ...
to the custom footer view, and also to the UIButton.
This is what Xcode prints when recording the test at the moment of pressing the button:
app.otherElements["ACTIVITY_VIEW"].tables["ACTIVITY_TABLE_VIEW"].children(matching: .other)["FOOTER_VIEW"].children(matching: .other)["FOOTER_VIEW"].tap()
Also, when printing the results of XCUIApplication().debugDescription I only see the following for the section:
Other, 0x600002251880, {{0.0, 272.0}, {414.0, 68.0}}, identifier: 'FOOTER_VIEW'
Other, 0x60000224bc60, {{0.0, 0.0}, {0.0, 0.0}}
I'm not able to see there the button, even if I set an accessibilityIdentifier to it.
Fixed!
It was a problem with the mock data. The tableView was confusing the rows between the different sections.
Setting accessibilityIdentifier to the target button is enough.