?????????????

????3?????????????????????????

???????Tune-up????

???????????????????????α?д?????????????????????????????д???Щ????????????????????????????????

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();

???????????????????????С??Javascript???????????д??UIAutomation??????????????https://github.com/alexvollmer/tuneup_js??????????????????????????????檔?????????????Tune-Up????????±?д?????Test1.js??

#import "tuneup/tuneup.js"
 
test("Test 1"?? function(target?? app) {
    var window = app.mainWindow();
    app.logElementTree();
 
    //-- select the elements
    UIALogger.logMessage( "Select the first tab" );
    var tabBar = app.tabBar();
    var selectedTabName = tabBar.selectedButton().name();
 
    if (selectedTabName != "First") {
        tabBar.buttons()["First"].tap();
    }
 
    //-- tap on the text fiels
    UIALogger.logMessage( "Tap on the text field now" );
    var recipeName = "Unusually Long Name for a Recipe";
    window.textFields()[0].setValue(recipeName);
    target.delay( 2 );
 
    //-- tap on the text fiels
    UIALogger.logMessage( "Dismiss the keyboard" );
    app.logElementTree();
    app.keyboard().buttons()["return"].tap();
    var textValue = window.staticTexts()["RecipeName"].value();
    assertEquals(recipeName?? textValue);
});

????Tune-Up??????????д???????????????????????????????????

ssertTrue(expression?? message)??
assertMatch(regExp?? expression?? message)??
assertEquals(expected?? received?? message)??
assertFalse(expression?? message)??
assertNull(thingie?? message)??
assertNotNull(thingie?? message)??
assertNull(thingie?? message)??
assertNotNull(thingie?? message)

???????

?????????????????????????????磬??????????????????uiautomation-ext.js?????????UIATarget??????logDevice??????

extend(UIATarget.prototype?? {
        logDevice: function(){
        UIALogger.logMessage("Dump Device:");
        UIALogger.logMessage(" model: " + UIATarget.localTarget().model());
        UIALogger.logMessage(" rect: " + JSON.stringify(UIATarget.localTarget().rect()));
        UIALogger.logMessage(" name: "+ UIATarget.localTarget().name());
        UIALogger.logMessage(" systemName: "+ UIATarget.localTarget().systemName());
        UIALogger.logMessage(" systemVersion: "+ UIATarget.localTarget().systemVersion());
    }
});