Acceptance testing of a route fails if a view uses this.$



We just started to implement acceptance tests. We use ember-cli 0.2.5 and just used the blueprints. All of the blueprints for unit tests are working :smile: but I struggle to get the acceptance tests running. I just wanted to check if it is possible to visit the route “/login”. There is a login.js in the views folder. This file adjusts the login template file according to different screen sizes. Therefore I call this.$(…).css(…). This works great for the regular app but when I want to run the tests I get the following error:

not ok 2 PhantomJS 1.9 - Acceptance: Login can visit /login
        message: >
            TypeError: 'undefined' is not an object (evaluating 'this.$')
        Log: >

Do I have to include jQuery somehow special? I didn’t find anything which could help me. Does anyone has a hint or pointer how I could solve this issue?

Thanks a lot Krautman


It’s solved… it was just too late yesterday. Sorry for disturbing :smiley: The reason behind the problem was that I wrapped my Code into to fulfill the “async” constraint and therefore lost reference to “this”. Just a classical JavaScript mistake. Providing with “this” as context was the solution