我正在为一个项目使用 KIF 开发测试。我想知道是否可以让 KIF 模拟点击主页按钮?是否也可以在那个时候模拟其他动作,例如调出指挥中心或通知中心?
2 回答
3
至少为您提供部分答案,请deactivateAppForDuration
查看KIFTestActor.h
:
/*!
@abstract Backgrounds app using UIAutomation command, simulating pressing the Home button
@param duration Amount of time for a background event before the app becomes active again
*/
- (void)deactivateAppForDuration:(NSTimeInterval)duration;
于 2015-08-27T12:34:45.577 回答
2
对于 swift 3 和 Xcode 8,KIFSystemTestActor 的这个函数起作用:
system().deactivateApp(forDuration: 3)
extension XCTestCase {
func system(_ file : String = #file, _ line : Int = #line) -> KIFSystemTestActor {
return KIFSystemTestActor(inFile: file, atLine: line, delegate: self)
}
}
于 2016-11-10T12:33:02.743 回答