Acceptance Test - Timeouts

I have a rather special use case: I have an input field that issues a request when a user stops printing for 500 ms. It is designed as a multiple supplement.

I would like to write an acceptance test for this, but I cannot pass the tests correctly. The first passes, the second does not.

Ember runloop now has a nice description, but this behavior is really "something else."

This is my assistant for runloop timeout:

import Ember from 'ember';

export default Ember.Test.registerAsyncHelper('pauseFor', function (time) {
  return Ember.Test.promise(function (resolve) {
    Ember.run.later(resolve, time);
  });
});
Run codeHide result

And this is how I use it

it('should do something after 500ms', function () {
  visit('/');

  fillIn('.search-input', 'a');
  pauseFor(500);

  andThen(function () {
    // do my assertions/expectations here...
  });
});
Run codeHide result

This is the error I get: enter image description here

The strange thing is that I have 2 test cases, and the first one runs happily.

I think my question is: How to do it right? What am I missing here or what am I doing wrong? How can I just just skip the test?

Thanks for the stop!

+4

All Articles