docs: function waitUntil(fun) {
      var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var interval = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 20;
  
      var timedOut = false;
      var ok = false;
  
      if (timeout !== 0) (0, _wait2['default'])(timeout).then(function () {
          return timedOut = true;
      });
  
      return new Promise(function (resolve, reject) {
          var runLoop = function runLoop() {
              if (ok) {
                  resolve();
                  return;
              }
              if (timedOut) {
                  reject(new Error('AsyncTestUtil.waitUntil(): reached timeout of ' + timeout + 'ms'));
                  return;
              }
              (0, _wait2['default'])(interval).then(function () {
                  var value = (0, _promisify2['default'])(fun());
                  value.then(function (val) {
                      ok = val;
                      runLoop();
                  });
              });
          };
          runLoop();
      });
  }