【发布时间】:2019-11-21 12:38:10
【问题描述】:
我的 UITest 需要点击一个按钮,并且 UIInteruptionMonitor 应该处理它。但是,发生的情况是按钮被点击,中断出现并得到处理,然后它尝试再次点击按钮。它似乎认为它实际上并没有点击按钮......
我有以下代码:
addUIInterruptionMonitor(withDescription: "Permissions") { alert -> Bool in
let okButton = alert.buttons["OK"]
if okButton.exists {
okButton.tap()
}
return true
}
app.buttons["Enable"].tap()
会发生以下情况:
t = 91.24s Find the "Enable" Button
t = 91.40s Check for interrupting elements affecting "Enable" Button
t = 91.42s Wait for com.apple.springboard to idle
t = 91.85s Found 1 interrupting element:
t = 91.86s Find the "“MyApp” Would Like to Access the Camera" Alert
t = 92.03s "“MyApp” Would Like to Access the Camera" Alert from Application 'com.apple.springboard'
t = 92.03s Invoking UI interruption monitors for "“MyApp” Would Like to Access the Camera" Alert from Application 'com.apple.springboard'
t = 92.03s Invoking Permissions
t = 92.04s Checking existence of `"OK" Button`
t = 92.21s Tap "OK" Button
t = 92.21s Wait for com.apple.springboard to idle
t = 92.50s Find the "OK" Button
t = 92.66s Check for interrupting elements affecting "OK" Button
t = 92.82s Synthesize event
t = 93.14s Wait for com.apple.springboard to idle
t = 93.54s Verifying handling...
t = 93.54s Check for interrupting elements affecting "Enable" Button
t = 93.55s Wait for com.apple.springboard to idle
t = 94.10s Confirmed successful handling of interrupting element
t = 94.10s Synthesize event
t = 95.39s Scroll element to visible
t = 96.55s Failed: Failed to scroll to visible (by AX action) Button, label: 'Enable', error: Error kAXErrorCannotComplete performing AXAction 2003 on element AX element pid: 62934, elementOrHash.elementID: 140664883255456.613
t = 97.57s Retrying `Tap "Enable" Button` (attempt #2)
【问题讨论】:
标签: ios xcode-ui-testing