Having trouble doing integration testing with Konacha on Ember.js 1.0.rc1. My problem is that all tests run before any views are rendered. Is there a way to know when everything has been rendered without the need to do manual timeouts?
spec helper:
//=require sinon
//=require jquery
//=require jquery_ujs
//=require twitter/bootstrap
//=require handlebars
//=require ember
//=require ember-data
//=require_self
//=require icarium
window.lookupController = (name) ->
Icarium.__container__.lookup('controller:' + name)
window.currentPath = ->
lookupController('application').get('currentPath')
Ember.testing = true
Ember.run ->
window.Icarium = Ember.Application.create()
the test:
//=require spec_helper
describe "user login", ->
before (done) ->
Ember.run ->
Icarium.set 'ready', ->
done()
Icarium.initialize()
afterEach ->
Ember.run ->
Icarium.reset()
it "routes to login", ->
Ember.run ->
currentPath().should.eq "login"
it "renders the login form", ->
$('input[type=password]').should.exist
Maybe setting Konacha's reset function to a noop will do the trick:
Konacha.reset = ->
By default it clears the body elmenet before each test. You can find this and other useful tipps in Jo Liss' slides: http://www.slideshare.net/jo_liss/testing-ember-apps