In my UI tests, I create a UIView
programmatically using (shortened)
let topMarker = UIView.init(frame: CGRect.init())
…
topMarker.accessibilityIdentifier = kTopMarker
The topMarker
view is in a custom table view cell.
In my UI tests, I use
let new1stCell = app.cells.element(boundBy: 0)
let topMarker = new1stCell.otherElements[kTopMarker]
let topMarkerExists = topMarker.waitForExistence(timeout: 15)
XCTAssertTrue(topMarkerExists, "Top marker does not exist")
XCTAssertTrue(topMarker.isHittable, "Top marker is not hittable")
When I set a Test Failure breakpoint, the test stops at the last line, i.e. topMarker
exists, but is not hittable.
On the other hand, I can see the view in the snapshot, i.e. it exists and is visible.
This is stange, because the docs say:
isHittable returns true if the element exists and can be clicked, tapped, or pressed at its current location. It returns false if the element does not exist, is offscreen, or is covered by another element.
I thought, maybe it is visible, but cannot be clicked, tapped, or pressed, because userInteractionEnable
is not true
, but even if I set this property to true
, the view does not become hittable.
What am I missing?