从XCTest UI测试中的活动呼叫打开CallKit屏幕

问题描述 投票:1回答:1

我有一个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
ios xcode call xcuitest
1个回答
0
投票

我从没做过,但是您可以尝试使用XCUIApplication(bundleIdentifier: "com.apple.mobilephone").launch()切换回通话。

© www.soinside.com 2019 - 2024. All rights reserved.