function assertWindow(window) {
  target = UIATarget.localTarget();
  application = target.frontMostApp();
  mainWindow = application.mainWindow();

  assertElementTree(mainWindow, window);
}
/**
 * Assert that the given window definition matches the current main window. The
 * window definition is a JavaScript object whose property hierarchy matches
 * the main UIAWindow.  Property names in the given definition that match a
 * method will cause that method to be invoked and the matching to be performed
 * and the result. For example, the UIAWindow exposes all UITableViews through
 * the tableViews() method. You only need to specify a 'tableViews' property to
 * cause the method to be invoked.
 *
 * PROPERTY HIERARCHY Property definitions can be nested as deeply as
 * necessary. Matching is done by traversing the same path in the main
 * UIAWindow as your screen definition. For example, to make assertions about
 * the left and right buttons in a UINavigationBar you can do this:
 *
 * assertWindow({
 *   navigationBar: {
 *     leftButton: { name: "Back" },
 *     rightButton: ( name: "Done" },
 *   }
 * });
 *
 * PROPERTY MATCHERS For each property you wish to make an assertion about, you
 * can specify a string, number regular expression or function. Strings and
 * numbers are matches using the assertEquals() method. Regular expressions are
 * matches using the assertMatch() method.
 *
 * If you specify 'null' for a property, it means you don't care to match.
 * Typically this is done inside of arrays where you need to match the number
 * of elements, but don't necessarily care to make assertions about each one.
 *
 * Functions are given the matching property as the single argument. For
 * example:
 *
 * assertWindow({
 *   navigationBar: {
 *     leftButton: function(button) {
 *       // make custom assertions here
 *     }
 *   }
 * });
 *
 * ARRAYS
 * If a property you want to match is an array (e.g. tableViews()), you can
 * specify one of the above matchers for each element of the array. If the
 * number of provided matchers does not match the number of given elements, the
 * assertion will fail (throw an exception)
 *
 * In any case, you specify another object definition for each property to
 * drill-down into the atomic properties you wish to test. For example:
 *
 * assertWindow({
 *   navigationBar: {
 *     leftButton: { name: "Back" },
 *     rightButton: ( name: "Done" },
 *   },
 *   tableViews: [
 *     {
 *       groups: [
 *         { name: "First Group" },
 *         { name: "Second Group" }
 *       ],
 *       cells: [
 *         { name: "Cell 1" },
 *         { name: "Cell 2" },
 *         { name: "Cell 3" },
 *         { name: "Cell 4" }
 *       ]
 *     }
 *   ]
 * });
 *
 * HANDLING FAILURE If any match fails, an appropriate exception will be
 * thrown. If you are using the test structure provided by tuneup, this will be
 * caught and detailed correctly in Instruments.
 *
 * POST-PROCESSING If your screen definition provides an 'onPass' property that
 * points to a function, that function will be invoked after all matching has
 * been peformed on the current window and all assertions have passed. This
 * means you can assert the structure of your screen and operate on it in one
 * pass:
 *
 * assertWindow({
 *   navigationBar: {
 *     leftButton: { name: "Back" }
 *   },
 *   onPass: function(window) {
 *     var leftButton = window.navigationBar().leftButton();
 *     leftButton.tap();
 *   }
 * });
 */
Assert that the given window definition matches the current main window. The
window definition is a JavaScript object whose property hierarchy matches
the main UIAWindow.  Property names in the given definition that match a
method will cause that method to be invoked and the matching to be performed
and the result. For example, the UIAWindow exposes all UITableViews through
the tableViews() method. You only need to specify a 'tableViews' property to
cause the method to be invoked.

PROPERTY HIERARCHY Property definitions can be nested as deeply as
necessary. Matching is done by traversing the same path in the main
UIAWindow as your screen definition. For example, to make assertions about
the left and right buttons in a UINavigationBar you can do this.



PROPERTY MATCHERS For each property you wish to make an assertion about, you
can specify a string, number regular expression or function. Strings and
numbers are matches using the assertEquals() method. Regular expressions are
matches using the assertMatch() method.

If you specify 'null' for a property, it means you don't care to match.
Typically this is done inside of arrays where you need to match the number
of elements, but don't necessarily care to make assertions about each one.

Functions are given the matching property as the single argument. For
example.

assertWindow({
navigationBar: {
leftButton: function(button) {
make custom assertions here
}
}
}).

ARRAYS
If a property you want to match is an array ), you can
specify one of the above matchers for each element of the array. If the
number of provided matchers does not match the number of given elements, the
assertion will fail (throw an exception)

In any case, you specify another object definition for each property to
drill-down into the atomic properties you wish to test. For example.



HANDLING FAILURE If any match fails, an appropriate exception will be
thrown. If you are using the test structure provided by tuneup, this will be
caught and detailed correctly in Instruments.

POST-PROCESSING If your screen definition provides an 'onPass' property that
points to a function, that function will be invoked after all matching has
been peformed on the current window and all assertions have passed. This
means you can assert the structure of your screen and operate on it in one
pass.

assertWindow({
navigationBar: {
leftButton: { name: "Back" }
},
onPass: function(window) {
var leftButton = window.navigationBar().leftButton();
leftButton.tap();
}
}).
Assert that the given window definition matches the current main window . The window definition is a JavaScript object whose property hierarchy matches the main UIAWindow . Property names in the given definition that match a method will cause that method to be invoked and the matching to be performed and the result . For example the UIAWindow exposes all UITableViews through the tableViews () method . You only need to specify a ' tableViews ' property to cause the method to be invoked . PROPERTY HIERARCHY Property definitions can be nested as deeply as necessary . Matching is done by traversing the same path in the main UIAWindow as your screen definition . For example to make assertions about the left and right buttons in a UINavigationBar you can do this . PROPERTY MATCHERS For each property you wish to make an assertion about you can specify a string number regular expression or function . Strings and numbers are matches using the assertEquals () method . Regular expressions are matches using the assertMatch () method . If you specify ' null ' for a property it means you don ' t care to match . Typically this is done inside of arrays where you need to match the number of elements but don ' t necessarily care to make assertions about each one . Functions are given the matching property as the single argument . For example . assertWindow ( { navigationBar : { leftButton : function ( button ) { make custom assertions here } } } ) . ARRAYS If a property you want to match is an array ) you can specify one of the above matchers for each element of the array . If the number of provided matchers does not match the number of given elements the assertion will fail ( throw an exception ) In any case you specify another object definition for each property to drill - down into the atomic properties you wish to test . For example . HANDLING FAILURE If any match fails an appropriate exception will be thrown . If you are using the test structure provided by tuneup this will be caught and detailed correctly in Instruments . POST - PROCESSING If your screen definition provides an ' onPass ' property that points to a function that function will be invoked after all matching has been peformed on the current window and all assertions have passed . This means you can assert the structure of your screen and operate on it in one pass . assertWindow ( { navigationBar : { leftButton : { name : " Back " } } onPass : function ( window ) { var leftButton = window . navigationBar () . leftButton () ; leftButton . tap () ; } } ) .
function assertWindow(window) {
  target = UIATarget.localTarget();
  application = target.frontMostApp();
  mainWindow = application.mainWindow();
  assertElementTree(mainWindow, window);
}
function assertWindow ( window ) { target = UIATarget . localTarget ( ) ; application = target . frontMostApp ( ) ; mainWindow = application . mainWindow ( ) ; assertElementTree ( mainWindow , window ) ; }
Assert that the given window definition matches the current main window.
Assert that the given window definition matches the current main window .