誰かがこれを必要とする場合は、ここに私のスクリプトがあります。正しいサインイン機能も同様です。
function wrongSignIn() {
// Assume you are on the signin page already
var target = UIATarget.localTarget();
var appWindow = target.frontMostApp().mainWindow();
// Assume you name the text fields username/password and they are accessible
appWindow.textFields()["username"].setValue("correct username");
appWindow.textFields()["password"].setValue("wrong password");
// Assume you have a button called "Sign in"
appWindow.buttons()["Sign in"].tap();
// Probably you need some delay for the UI to appear
target.delay(3);
var alert = target.frontMostApp().alert();
// Make sure the alert is on screen with right message, and stay on old screen
if (alert.checkIsValid() && alert.name() == "Wrong password!"
&& appWindow.name() == "Sign in") {
UIALogger.logPass("Pass the wrong signin test.");
} else {
UIALogger.logFail("Fail the wrong signin test.");
}
}
あなたはUIAutomationに関するいくつかの質問をしており、すでにAppleのドキュメントを知っています。助けてくれる素晴らしいリソースがあります:http://pragprog.com/book/jptios/test-ios-apps-with-ui-automationこの本はまだベータ版ですが、私はそれを持っており、とても便利です。免責事項:私は著者を知っていますが、私はそのために彼の本をshillingしていません。また、UIAutomationについて議論している過去数年間のWWDCビデオとスライドがいくつかあります。しかし、セッション番号は分かりません。 – stevekohls