code: function waitfn () {
    const softTimeout = this.timeout || null
    const callback = this.callback
    let executionTimer
    let softTimeoutTimer
    let self = arguments[0]
  
    let args = sliced(arguments)
    let done = args[args.length - 1]
  
    let timeoutTimer = setTimeout(function () {
      clearTimeout(executionTimer)
      clearTimeout(softTimeoutTimer)
      done(new Error(`.wait() timed out after ${self.options.waitTimeout}msec`))
    }, self.options.waitTimeout)
    return tick.apply(this, arguments)
  
    function tick (self, fn) {
      if (softTimeout) {
        softTimeoutTimer = setTimeout(function () {
          clearTimeout(executionTimer)
          clearTimeout(timeoutTimer)
          done()
        }, softTimeout)
      }
  
      let waitDone = function (err, result) {
        if (callback) {
          result = callback(result)
        }
        if (result) {
          clearTimeout(timeoutTimer)
          clearTimeout(softTimeoutTimer)
          return done()
        } else if (err) {
          clearTimeout(timeoutTimer)
          clearTimeout(softTimeoutTimer)
          return done(err)
        } else {
          executionTimer = setTimeout(function () {
            tick.apply(self, args)
          }, self.options.pollInterval)
        }
      }
      let newArgs = [fn, waitDone].concat(args.slice(2, -1))
      self.evaluate_now.apply(self, newArgs)
    }
  }
docs: Wait until evaluated function returns true.
  
  @param {Nightmare} self
  @param {Function} fn
  @param {...} args
  @param {Function} done