Setting up testing


I am trying to write a simple Ember integration test and continue to get the frustrating run loop error despite using I’ve had a nightmare of a time trying to get this to work, if anyone could help me I’d be so grateful. Specifically, I can see the test sign in and begin loading the next page (as it should), but as soon as the test finishes I get that error. This is regarding the second test, the first passes (as nothing is async I believe).

import Ember from 'ember';
import startApp from 'jobs-tuftsdaily/tests/helpers/start-app';
import exists from 'jobs-tuftsdaily/tests/helpers/start-app';

var App;

module('Integration - Landing Page', {
    setup: function() {
        App = startApp();
    teardown: function() {, 'destroy');

test('Should load content', function() {
  visit('/').then(function() {
    ok(exists("*"), "Found HTML!");
    ok(exists('label:eq(4)'), "Slug label on page");

test('Should sign in test user', function() { {
    visit('/').andThen(function() {
      return fillIn("input[name=email]", "");
    }).andThen(function() {
      return fillIn("input[type=password]", "password");
    }).andThen(function() {
      return click("button");
    }).andThen(function() {
      ok(1, "stupid test passed");


I also modified it with the same issue:

test('Should sign in test user', function() {
  expect(2); {
    fillIn("input[name=email]", "");
    fillIn("input[type=password]", "password");

    andThen(function() {
      ok(true, "stupid test passed");

Bootstrap navbar collapse

You have to use in your application code. Anywhere there is async code, wrap it in an


With AJAX callbacks:

    App.User.login(data).then(function(response) { {

    }, function(error) { {


When setting a property: {
    this.set('propertyName', newProperty);

It may seem annoying at first, but it makes sense once you understand what Ember has been doing for you behind the scenes with the Autorun. Ember has been wrapping your Async code automagically. In testing, that is disabled. It’s better to learn more about the run loop, and manage it yourself to make you app testable.

I hope this helps.


I can’t seriously have to wrap ALL my async calls in in my application code just to test my application? Or do I? That seems incredibly tedious?


I have it confirmed from Toran Billups who gave a talk on testing in Ember at Ember Conf 2015. You do need to wrap your app code with the Ember run like I had posted. You can find libraries like one at his repo that abstracts it.


I’ll try this out! Thank you for your help.