다른 사람이 필요로하는 경우에는 여기에 내 스크립트가 있습니다. 올바른 로그인 기능은 유사합니다.
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입니다. 이 책은 아직 베타 버전이지만 책이있어 매우 편리합니다. 면책 조항 : 나는 저자를 알고 있지만 그 때문에 그의 책은 실망하지 않습니다. 또한 지난 몇 년 동안 UIAutomation을 논의하는 몇 개의 WWDC 비디오와 슬라이드가 있습니다. 세션 번호의 확실하지. – stevekohls