【问题标题】:Clearing an SFAuthenticationSession alert in an XCUITest with addUIInterruptionMonitor()使用 addUIInterruptionMonitor() 清除 XCUITest 中的 SFAuthenticationSession 警报
【发布时间】:2018-05-01 07:02:04
【问题描述】:

是否有人在运行 XCUITest 时成功使用 addUIInterruptionMonitor 清除了由 start()SFAuthenticationSession 产生的警报?

我无法让它在 Xcode 9.1/iOS 11.1.1(模拟器或设备)上运行。 standard advice(设置处理程序并随后在警报出现之前与设备交互)没有帮助。

测试记录器说app.alerts.firstMatch.buttons["Continue"]).tap() 应该可以解决问题,但这也不起作用。来自另一个 SO 答案的This 技术有时有效,但在 CI 上并非始终如一。

所以我想知道“官方”解决方案是否对任何人都有效。

【问题讨论】:

    标签: ios xcode-ui-testing xcuitest sfauthenticationsession


    【解决方案1】:

    我无法让它工作:

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

    但这个 hack 似乎可以解决问题:

    let statusBarsQuery = app.statusBars
    statusBarsQuery.element.tap()
    

    【讨论】:

      猜你喜欢
      • 2017-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-19
      • 1970-01-01
      • 1970-01-01
      • 2021-12-30
      • 1970-01-01
      相关资源
      最近更新 更多