I cribbed this from the browser Marionette JS tests.  I should probably note its origin...