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

**URL:** <https://discuss.emberjs.com/t/acceptance-testing-of-a-route-fails-if-a-view-uses-this/8037>\
**Category:** Testing\
**Created:** [May 19, 2015, 3:52pm UTC](https://discuss.emberjs.com/t/acceptance-testing-of-a-route-fails-if-a-view-uses-this/8037 "2015-05-19T15:52:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![krautman](https://avatars.discourse-cdn.com/v4/letter/k/b3f665/32.png) [@krautman](https://discuss.emberjs.com/u/krautman)\
**Post date:** [May 19, 2015, 3:52pm UTC](https://discuss.emberjs.com/t/acceptance-testing-of-a-route-fails-if-a-view-uses-this/8037/1 "2015-05-19T15:52:10Z")

</div>

Hey!

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 😄 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.$')
            (http://localhost:7357/assets/web-app.js:5933)
        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

---

<div class="post-metadata">

**Author:** ![krautman](https://avatars.discourse-cdn.com/v4/letter/k/b3f665/32.png) [@krautman](https://discuss.emberjs.com/u/krautman)\
**Post date:** [May 20, 2015, 6:36am UTC](https://discuss.emberjs.com/t/acceptance-testing-of-a-route-fails-if-a-view-uses-this/8037/2 "2015-05-20T06:36:24Z")

</div>

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