I am trying to do a simple integration test and I started from the integration example on the ember-cli website. Right now when I test in a browser (localhost:4200/tests), the follow case routes to where I expect, but then it just hangs and never does success or failure.
import Ember from "ember";
import { test } from 'ember-qunit';
import startApp from '../helpers/start-app';
var App;
module('Integration - Create Event', {
setup: function() {
App = startApp();
},
teardown: function() {
Ember.run(App, App.destroy);
}
});
test('check customers', function() {
visit('/new');
andThen(function() {
fillIn('input#title', 'The Event Name');
ok(true);
// equal(find('.customers input[type="checkbox"]').length, 6, 'Customer checkboxes showing');
});
});
Is there something I am doing wrong here? Or is there a different way to do it?
ember-cli 0.1.5 and ember 1.9.1
Edit:
ENV.APP.LOG_ACTIVE_GENERATION = true;
ENV.APP.LOG_TRANSITIONS = true;
ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
Enabling logging shows that the transition completes, but andThen still never resolves or gets rejected.
Edit:
I think I've narrowed it down. I have a clock service that I am injecting into all controllers, but when I don't inject it at all, my test passes. I need the functionality the clock service provides, how can I still use it, but get my integration tests to work?
// services/clock.js
import Ember from 'ember';
export default Ember.Object.extend({
pulse: Ember.computed.oneWay('_seconds').readOnly(),
minutePulse: Ember.computed.oneWay('_minutes').readOnly(),
tick: function () {
var clock = this;
Ember.run.later(function () {
var seconds = clock.get('_seconds');
var minutes = clock.get('_minutes');
if (typeof seconds === 'number') {
clock.set('_seconds', seconds + 1);
if(Math.floor((seconds + 1) / 60) > minutes) {
clock.set('_minutes', minutes + 1);
}
}
}, 1000);
}.observes('_seconds').on('init'),
_seconds: 0,
_minutes: 0
});
An example project can be found at https://github.com/RyanHirsch/ember-test-example. If I remove the run.later the tests will pass.