I have a test for a collection view that works like this:
func testDeleteItem() {
app.collectionViews.staticTexts["Item"].tap()
app.buttons["Delete"].tap()
XCTAssertEqual(app.collectionViews.cells.count, 2)
XCTAssertFalse(app.collectionViews.cells.staticTexts["Item"].exists)
}
After the tap, there is a new screen with the delete button. When the button is tapped, the screen dismisses itself and reloads the collection view. Everything goes as expected in the UI, but I get both asserts failing. In the first count it is still 3 and in the second item it still exists.
expectationForPredicate
withwaitForExpectationsWithTimeout
also fails. – SporangiumcollectionView:didSelectCell:
, putting the asserts in old gooddispatch_async
makes the tests pass. It does not seems to be a proper solution, but points out on threading as well. Interesting – Emedispatch_async
, how did you managed to do this? – Sporangiumdispatch_async(dispatch_get_main_queue())
), anywaydispatch_async
is a no go, it simply causes the assert to be not taken into accountXCTAssertFalse(true)
also passes ;) have you tried the very same scenario but with tableView? If this works it might indicate that there is indeed some bug – Eme