I have a collectionView
with static data, with is loaded in viewDidLoad
method. But the UITest
gives me error because there is no cells. Here is my UITest
method:
func testSelectCardAndValue(){
app.buttons["btnPay"].tap()
let collectionView = app.collectionViews
let exists = NSPredicate(format: "exists == true")
print("Qtde : \(collectionView.cells.count)") //ALWAYS SHOWING 0
expectation(for: exists, evaluatedWith: collectionView.cells.firstMatch, handler: nil)
waitForExpectations(timeout: 20, handler: nil)
if(app.collectionViews.cells.count > 0) {
app.collectionViews.cells.firstMatch.tap()
}
}
Here is my screenshot of the view at the exact moment that the test failed. There is data in there. What is wrong?