我刚开始用tuneup.js尝试UIAutomation。我可以很好地测试我的第一个窗口,但是第二个窗口失败了 - 我的应用程序仍在查看第一个窗口并看到例如“使用Facebook登录”按钮。我试过添加延迟,但这似乎没有帮助。对我做错了什么的想法?
#import "tuneup.js"
target = UIATarget.localTarget();
application = target.frontMostApp();
test("Test first-run view controller", function(app, target) {
assertWindow({
buttons : [
{ name : "Sign in with Facebook"},
{ name : "Create account"},
{ name : "Login"},
{ name : "Try"}
],
onPass: function(window) {
var createAccountButton = window.buttons()["Create account"]
createAccountButton.tap();
}
});
});
test("Test Sign-in screen", function(app, target) {
assertWindow({
buttons : [
{ name : "Sign up"}
]
});
});
答案 0 :(得分:0)
test("Test the account creation", function(app, target) {
assertWindow({
scrollViews: [
{ buttons : [
{name :"Sign up"},
{name : "Terms and Conditions"}
]
}
],
onPass: function(window) {
var signUpButton = window.scrollViews()[0].buttons()["Sign up"];
signUpButton.tap()
}
});
});