我正在迅速使用以下代码
@IBAction func letsPlay(_ sender: UIButton) {
if(input.text == "xxx@123")
{
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(4), execute: {
let storybord = UIStoryboard(name: "Main", bundle: nil)
let vc = storybord.instantiateViewController(withIdentifier: "ViewController2")as! ViewController2
self.navigationController?.pushViewController(vc, animated: true)
})
}
在我的测试中,我使用以下代码
func testValidKey() {
EarlGreyImpl.invoked(fromFile: #file, lineNumber: #line).selectElement(with: grey_accessibilityID("inner")).perform(grey_replaceText("xxx@123"))
var error:NSError?
EarlGreyImpl.invoked(fromFile: #file, lineNumber: #line).selectElement(with: grey_accessibilityID("logo")).perform(grey_tap(), error:&error)
EarlGreyImpl.invoked(fromFile: #file, lineNumber: #line).selectElement(with: grey_accessibilityID("View2")).assert(grey_sufficientlyVisible())
}
测试时,earlgrey 应该等待,因为它具有同步属性,但它向我显示“没有匹配元素”的错误