ios - How can I control the time after an UIButton has been tapped to prepare for next action in UI Testing with Xcode -
i using ui test xcode 7 have few problems. when record ui test, xcode translates chinese unicode uppercase 'u' , shows errors. , ui test code
xcuiapplication *app = [[xcuiapplication alloc] init]; [app.navigationbars[@"\u5934\u6761"].images[@"new_not_login30"] tap]; xcuielementquery *tablesquery = app.tables; [tablesquery.cells.statictexts[@"\u6211\u7684\u864e\u94b1"] tap];
the problem is: after tapping image, there animation showing sidebar uitableview or showing uialertcontroller cannot handle duration time. actually, within animation testing continues find next elements match these elements not exist or generating. test failed. solution answer question? please me. thanks.
try expectationforpredicate. don't know syntax in objective-c. here part of code in swift:
let app = xcuiapplication() app.navigationbars["\u5934\u6761"].images["new_not_login30"].tap() let label = app.cells.statictexts["\u6211\u7684\u864e\u94b1"] let exists = nspredicate(format: "exists == 1") expectationforpredicate(exists, evaluatedwithobject: label) { // if label exists, check enabled if label.enabled { label.tap() return true } else { return false } } waitforexpectationswithtimeout(5) { error in if (error != nil) { assertion ....} }
just translate code in objective-c.
cheers
Comments
Post a Comment