Clearing an SFAuthenticationSession alert in an XCUITest with addUIInterruptionMonitor()
Asked Answered
C

1

7

Has anybody successfully used addUIInterruptionMonitor to clear the alert produced by start()ing an SFAuthenticationSession while running an XCUITest?

I can't get it to work on Xcode 9.1/iOS 11.1.1 (simulator or device). The standard advice (setting up the handler and subsequently interacting with the device before the alert appears) does not help.

The test recorder says app.alerts.firstMatch.buttons["Continue"]).tap() should do the trick, but that doesn't work either. This technique from another SO answer works sometimes, but not consistently on CI.

So I'd like to know if the "official" solution has ever worked for anyone.

Cistercian answered 17/11, 2017 at 13:25 Comment(0)
O
1

I couldn't get this to work:

let continueButton = app.alerts.buttons["Continue"]
XCTAssert(waitAndTap(continueButton), "could not tap on alert \"Continue\" button"

But this hack seems to do the trick:

let statusBarsQuery = app.statusBars
statusBarsQuery.element.tap()
Ozellaozen answered 16/10, 2018 at 22:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.