Today I Learned

hashrocket A Hashrocket project

Using the `wait` helper in Ember integration tests

Component integration tests are a powerful way to test your Ember components in relative isolation. They look something like this:

test('it renders', function(assert) {


  assert.equal(this.$().text().trim(), '');

Sometimes, however, you'll want to handle a bit of asynchrony. Thanks to rwjblue that is now not too big of a deal with the wait helper:

import { moduleForComponent, test } from 'ember-test-helpers';
import wait from 'ember-test-helpers/wait';

test('it works when async exists in an event/action', function(assert) {


  return wait()
    .then(() => {
      // assertions for after async behavior

And that's about it! You'll need to update ember-qunit to at least: v0.4.15


See More #emberjs TILs