Got a situation where our UI tests are failing because according to print(app.debugDescription) the XCUITests still "see" an SFSafariViewController even though it's been dismissed (and appears to be dismissed on the device.)
To illustrate:
print(app.debugDescription)
let result = app.navigationBars.staticTexts["My Title"].firstMatch.waitForExistence(timeout: 30)
print("Did I find it?")
print(result)
print("Maybe, see above")
In the above code, the first app.debugDescription prints an accessibility tree describing the SFSafariViewController. The print(result) statement prints "false" and breakpointing on the line after that and running po app.debugDescription shows me the same tree. Though it's obvious from the device display that the SFSafariViewController has been dismissed.
Anyone else seeing this problem? I'd like to know if it's a Known Bug before I go to the effort of swapping out SFSafariViewController for SFAuthenticationSession.
For future reference; the above *used* to work in Xcode 8/iOS 10, now we've found this works in Xcode 9/iOS 11:
func testExample() {
let result = app.naviagationBars["My Favourites"].firstMatch.waitForExistence(timeout: 10)
XCTAssert(result)
}Spot the difference*!
(* "staticTexts" is no longer allowed. I've updated the radar, I don't know if this counts as a regression or not.)