4 Replies
      Latest reply on Feb 14, 2020 5:22 AM by ChemicalFox
      andrea.vultaggio Level 1 Level 1 (0 points)

        Hi everyone!

         

        Is it possible that the use of the tap() method doesn't work on UITableViews when the cell is not visible? Official documentation says that the method should make the cell with the correspective identifier visible and then tap on it.

         

        But if I try this code:

        let app = XCUIApplication()
        
        let myTableView = app.tables.element(matching: .table, identifier: "tableView01")
        let myCell = myTableView.cells.element(matching: .cell, identifier: "tappableCell")
        
        myCell.tap()
        
        
        
        


        I get this error: << UITests.testP() failed: Computed invalid hit point (-1.2, -0.5) for Cell, 0x17419c7d0, traits: 8589934593, identifier: 'tappableCell' >>

         

        And if I change the code into this:

        let app = XCUIApplication()
        
        let myTableView = app.tables.element(matching: .table, identifier: "tableView01")
        myTableView.swipeUp(). //I swipe so that the cell becomes visible...
        
        let myCell = myTableView.cells.element(matching: .cell, identifier: "tappableCell")
        myCell.tap()
        
        
        
        


        Nothing happens! On the command line I get the log as the action should've been computed but on the screen nothing happens!

         

        Then I tried positioning a breakpoint just before the tap() method and giving the tap command manually from the command line writing 'po myCell.tap()' and it worked indeed! What's happening?! I have the same strange bug with both Xcode 8.3.3 and Xcode 9 - Beta 4.

        Do you know any possible solution? Am I wrong in something? It could be related with my usage of accessibility identifiers to run the query?

         

         

        Thank you for your support!

        Andrea