The setup is very simplistic attempt at getting an acceptance test ( end to end)
Rails API server with public data set
Ember.model Item
Index Route model: returns RSVP.hash including ‘items’
Controller that runs filter on items model from Index route.
I have a couple other basic tests. (does an element exist on the page)
I’m working off of the documents i’ve found - and this makes sense to me - reset the app before each test.
module "Browse Item",
setup: ->
App.reset()
My question is why is only a single ajax request being made?
I visit the index 2 times, in a total of 2 tests, once for each test.
I see only a single ajax request in the network tab.
I’m also noticing the following behavior
all Ajax requests are going all the way down to the Ember.model layer, but the second visit never calls the succeed or failure callback.
defining afterModel or beforeModel (with a promise returned) stops the model from being called altogether - ( this contradicts the documentation)
Of course removing App.reset allows both tests to pass - because the data was fetched a single time.
My instinct is that something in the Ember-Testing / App.reset is breaking the acceptance testing environment.
I suspect I wouldn’t have noticed this if I was mocking out the server.
Any thoughts?
The test error seems to indicate that something about the request is failing:
TypeError: Cannot call method 'get' of undefined
Source:
at Test.QUnitAdapter.Test.Adapter.extend.exception (http://u2u.local:3000/assets/ember.js?body=1:41419:5)
at superWrapper [as exception] (http://u2u.local:3000/assets/ember.js?body=1:1243:16)
at Ember.RSVP.onerrorDefault (http://u2u.local:3000/assets/ember.js?body=1:16896:28)
at Object.__exports__.default.trigger (http://u2u.local:3000/assets/ember.js?body=1:8721:13)
at Promise._onerror (http://u2u.local:3000/assets/ember.js?body=1:9445:16)
at Promise.publishRejection (http://u2u.local:3000/assets/ember.js?body=1:9852:17)
at Object.DeferredActionQueues.flush (http://u2u.local:3000/assets/ember.js?body=1:5897:24)
at Object.Backburner.end (http://u2u.local:3000/assets/ember.js?body=1:5988:27)