我有一个XCTest UI测试,其中两个设备使用CallKit建立呼叫。 当来电到达被叫方时,将显示CallKit屏幕。他接受呼叫后,将显示主测试应用程序,并将CallKit屏幕设为背景。这是默认行为。
有什么方法可以切换回CallKit屏幕?不一定需要使用XCTest方法,它可以是将由测试包调用的常规SDK代码。
我尝试记录打开多任务视图并切换到CallKit的过程,结果是:
let app = XCUIApplication()
app.children(matching: .window).element(boundBy: 0).children(matching: .other).element.children(matching: .other).element.children(matching: .other).element.tap()
app.otherElements["com.apple.InCallService"].tap()
但是当运行记录的代码时,测试失败并显示以下错误:
Assertion Failure: Failed to get matching snapshot: No matches found for Elements matching predicate '"com.apple.InCallService" IN identifiers' from input
答案 0 :(得分:0)
我从没做过,但是您可以尝试使用XCUIApplication(bundleIdentifier: "com.apple.mobilephone").launch()
切换回通话。
答案 1 :(得分:0)
尝试通过以下方式激活此屏幕
XCUIApplication(bundleIdentifier: "com.apple.InCallService").activate()
或
XCUIApplication(bundleIdentifier: "com.apple.springboard").activate()