2017-08-22 65 views
0

我有一个问题,我使用表视图的底部刷新,但只有第一次正常工作。刷新表格后,我的测试已经结束。有我的代码:如何在UI测试中使用表格的视图底部刷新两次?

func test_lista(){ 

    //Entrar a la lista de ofertas 
    app.tables.element(boundBy: 0).cells.element(boundBy: 2).tap() 
    sleep(2) 

    //Arrastrar la ultima fila 
    app.swipeUp() 
    app.swipeUp() 
    let cell = app.tables.element(boundBy: 0).cells.element(boundBy: 2) 
    let start = cell.coordinate(withNormalizedOffset: CGVector(dx: 0,dy: 0)) 
    let finish = cell.coordinate(withNormalizedOffset: CGVector(dx: 0,dy: -30.0)) 
    start.press(forDuration: 0, thenDragTo: finish) 

    app.swipeUp() 
    app.swipeUp() 
    let cell2 = app.tables.element(boundBy: 0).cells.element(boundBy: 4) 
    let start2 = cell2.coordinate(withNormalizedOffset: CGVector(dx: 0,dy: 0)) 
    let finish2 = cell2.coordinate(withNormalizedOffset: CGVector(dx: 0,dy: -30.0)) 
    start2.press(forDuration: 0, thenDragTo: finish2) 

} 

我在做什么错?

回答

0

我找到了解决方案。我刚刚才使这条线添加到我的表视图的方法:

self.offerTableView.scrollToRow(at: IndexPath(row: lastIndex, section: 0), at: .bottom, animated: false) 

此功能由从我的表视图的静态位置时,我重装数据。所以只是我把这个代码和测试正常工作。

相关问题