【问题标题】:How do I allow tracking in UITest?如何允许在 UITest 中进行跟踪?
【发布时间】:2021-05-27 19:44:26
【问题描述】:

我已尝试调用“addUIInterruptionMonitor”以获取应用程序跟踪透明度通知,但它没有注册并且我的下一步操作失败。任何有关此对话框描述的帮助都会有所帮助,“系统对话框”不起作用。

“允许...跟踪您在其他公司的应用和网站上的活动”“要求应用不要跟踪”“允许”

addUIInterruptionMonitor(withDescription: "System dialog") {
        (alert) -> Bool in
        if alert.buttons["Cancel"].exists {
            alert.buttons["Cancel"].tap()
            self.app.activate()
            return true
        }
        
        return false
    }

【问题讨论】:

  • 请提供对话框的屏幕截图、可见时的调试输出以及不工作的代码。
  • 更新了问题代码和对话框截图

标签: swift tracking xcode-ui-testing xcuitest apptrackingtransparency


【解决方案1】:

找到了解决办法,我用的描述是“Tracking Usage Permission Alert”

这也是测试本身等待按钮出现的问题,该按钮仅在回答此对话框后才会出现

addUIInterruptionMonitor(withDescription: "Tracking Usage Permission Alert") {
        (alert) -> Bool in
        if alert.buttons["Allow"].exists {
            alert.buttons["Allow"].tap()
            self.app.activate()
            return true
        }
        return false    
    }

【讨论】:

  • 你怎么知道描述是“Tracking Usage Permission Alert”?这对我不起作用
  • 我很想知道如何为各种系统对话框找到withDescription 的集合。这些必须记录在某处!
猜你喜欢
  • 2020-09-10
  • 1970-01-01
  • 2013-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多