function waitUntil(testFunction) {
  return new Promise(function(resolve) {
    var tryTestFunction = function() {
      if (testFunction())
        resolve();
      else
        setTimeout(tryTestFunction, INTERVAL_FOR_WAIT_UNTIL);
    };

    tryTestFunction();
  });
}
/**
 * Waits until testFunction becomes true.
 * @param {function(): boolean} testFunction A function which is tested.
 * @return {!Promise} A promise which is fullfilled when the testFunction
 *     becomes true.
 */
Waits until testFunction becomes true.
@param {function(): boolean} testFunction A function which is tested.
@return {!Promise} A promise which is fullfilled when the testFunction
becomes true.
Waits until testFunction becomes true . @param { function () : boolean } testFunction A function which is tested . @return { !Promise } A promise which is fullfilled when the testFunction becomes true .
function waitUntil(testFunction) {
  return new Promise(function(resolve) {
    var tryTestFunction = function() {
      if (testFunction())
        resolve();
      else
        setTimeout(tryTestFunction, INTERVAL_FOR_WAIT_UNTIL);
    };
    tryTestFunction();
  });
}
function waitUntil ( testFunction ) { return new Promise ( function ( resolve ) { var tryTestFunction = function ( ) { if ( testFunction ( ) ) resolve ( ) ; else setTimeout ( tryTestFunction , INTERVAL_FOR_WAIT_UNTIL ) ; } ; tryTestFunction ( ) ; } ) ; }
Waits until testFunction becomes true.
Waits until testFunction becomes true .