SwiftUI XCTestCase - Cell never become hittable

177 views Asked by At

I'm trying to execute a XCTestCase where I have a list of elements. In this case my cell exists and it passes the first XCTAssertTrue, but is never hittable and when enter inside the while cycle it never come out. Any solutions? Thanks.

fileprivate func openDetailViewForAttendant(_ attendantBusinessName: String) {
    let cell = app.tables.staticTexts[attendantBusinessName]
    XCTAssertTrue(cell.waitForExistence(timeout: 3))
    
    while !cell.isHittable {
        app.swipeUp()
    }
    
    cell.tap()
}
1

There are 1 answers

2
Kudos On BEST ANSWER

Thanks for this question, as I also faced this problem.

Solution: This happens when cell is scrolled below or above the screen. That's why it's not hittable. So this is old bug in iOS.

Basically this happens with low resolution devices. So test on large resolution devices.