addUIInterruptionMonitor
全部标签 所以最近Apple推出了这个提示:“XXXX”WantstoUse“auth0.com”toSignIn其中“XXXX”是iOS应用名称。在Auth0的情况下,当用户单击“使用Google登录”或“使用Facebook登录”时,会出现此警报/对话框。这一切都很好,但是在运行IOSUI测试时,如果使用通常的关闭系统对话框的方式,此对话框不会消失:funcdoUserLogin(_app:XCUIApplication){app.staticTexts["notLoggedInActivelabel"].tap()//thiswillbringupoauth0loginwindowinio
有没有人成功地使用addUIInterruptionMonitor来清除由start()在运行XCUITest时SFAuthenticationSession产生的警报?我无法让它在Xcode9.1/iOS11.1.1(模拟器或设备)上运行。standardadvice(设置处理程序并随后在警报出现之前与设备交互)没有帮助。测试记录器说app.alerts.firstMatch.buttons["Continue"]).tap()应该可以解决问题,但这也不起作用。This来自另一个SO答案的技术有时有效,但在CI上并不一致。所以我想知道“官方”解决方案是否对任何人都有效。
privatefuncacceptPermissionAlert(){_=addUIInterruptionMonitor(withDescription:""){alert->Boolinifalert.buttons["Don’tAllow"].exists{//doesntgetheresecondtimealert.buttons.element(boundBy:1).tapWhenExists()returntrue}returnfalse}}这不适用于:在应用程序的开头,它在接受通知权限时运行良好,但在这里...不起作用。你知道为什么吗? 最佳答
privatefuncacceptPermissionAlert(){_=addUIInterruptionMonitor(withDescription:""){alert->Boolinifalert.buttons["Don’tAllow"].exists{//doesntgetheresecondtimealert.buttons.element(boundBy:1).tapWhenExists()returntrue}returnfalse}}这不适用于:在应用程序的开头,它在接受通知权限时运行良好,但在这里...不起作用。你知道为什么吗? 最佳答
以下测试在iOS11上运行良好。它消除了请求权限使用位置服务的警报,然后放大map。在iOS10或9上,它什么都不做,测试仍然成功functestExample(){letapp=XCUIApplication()varhandled=falsevarappeared=falselettoken=addUIInterruptionMonitor(withDescription:"Location"){(alert)->Boolinappeared=trueletallow=alert.buttons["Allow"]ifallow.exists{allow.tap()handled=t