我正在迅速使用以下代码
@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应该等待,因为它具有同步属性,但显示“没有匹配元素”的错误