UITesting Xcode 7: How to tell if XCUIElement is visible?

后端 未结 5 768
感动是毒
感动是毒 2021-01-02 02:43

I am automating an app using UI Testing in Xcode 7. I have a scrollview with XCUIElements (including buttons, etc) all the way down it. Sometimes the XCUIElements are visi

5条回答
  •  有刺的猬
    2021-01-02 03:12

    Since you have some XCUIElements in the bottom of the tableview (table footer view), the way of scrolling the tableview all the way to the bottom in the UI test, supposing your tableview has a lot data, is by tap().

    .swipeUp() also does the job but the problem is when your test data is huge, it takes forever to swipe, as oppose to .tap() which directly jumps to the bottom of the tableView.

    More specially:

    XCUIElementsInTheBottomOrTableFooterView.tap()
    XCTAssert(XCUIElementsInTheBottomOrTableFooterView.isHittable, "message") 
    

提交回复
热议问题