# Integration test not working

**URL:** <https://discuss.emberjs.com/t/integration-test-not-working/7140>\
**Category:** Testing\
**Created:** [January 22, 2015, 7:11pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140 "2015-01-22T19:11:36Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![batman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/batman/32/268_2.png) [@batman](https://discuss.emberjs.com/u/batman)\
**Post date:** [January 22, 2015, 7:11pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/1 "2015-01-22T19:11:36Z")

</div>

I have a very simple integration test in my Ember App kit. Issue is the andThen function is never called and the test cases remains stuck, none of the next test cases are executed. Also the click is never called and doesnt work. But if I put a debugger before click then it works, not sure whats going on. Even wrapping the click and andThen inside Ember.run.later doesnt work. The control never goes inside the later function. I am guessing this is related to some Ember.run.loop issue but not sure what. I dont see any errors at all. ☹

```
 test('renders', function(){
  expect(1);
  visit('/dashboard');
    var clickPromise = click('.nav-tabs > li:nth-child(2) > a');
     andThen(function(){
      var table = find('.dashboard-table table thead tr th:nth-child(1)');
      equal(table.text(), 'Name');
    });    
});

```

---

<div class="post-metadata">

**Author:** ![batman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/batman/32/268_2.png) [@batman](https://discuss.emberjs.com/u/batman)\
**Post date:** [January 22, 2015, 8:04pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/2 "2015-01-22T20:04:45Z")

</div>

Tried using setTimeout too… no luck. not sure whats wrong

---

<div class="post-metadata">

**Author:** ![kgish](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kgish/32/13333_2.png) [@kgish](https://discuss.emberjs.com/u/kgish)\
**Post date:** [January 24, 2015, 2:43pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/3 "2015-01-24T14:43:00Z")

</div>

Try the following format instead and see if that helps.

```javascript
visit('/dashboard').then(function() {
  click('...').then(function() {
    equal(find('...').text(), 'Name');
  });
});

```

---

<div class="post-metadata">

**Author:** ![batman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/batman/32/268_2.png) [@batman](https://discuss.emberjs.com/u/batman)\
**Post date:** [January 24, 2015, 8:53pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/4 "2015-01-24T20:53:21Z")

</div>

Thanks Kgish, have tried that too but no luck. My unit tests works just fine too.

---

<div class="post-metadata">

**Author:** ![kgish](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kgish/32/13333_2.png) [@kgish](https://discuss.emberjs.com/u/kgish)\
**Post date:** [January 24, 2015, 9:32pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/5 "2015-01-24T21:32:42Z")

</div>

Strange indeed. Perhaps you could provide more details and/or a reproducible test set to look into.

---

<div class="post-metadata">

**Author:** ![batman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/batman/32/268_2.png) [@batman](https://discuss.emberjs.com/u/batman)\
**Post date:** [January 24, 2015, 9:43pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/6 "2015-01-24T21:43:52Z")

</div>

Yes, have a lot of ember experts look at it with no leads. I wish I could provide any link, its an internal project and not reproducible on other projects. Its based of ember app kit. I know it will be hard to get help without the code. ☹ I might end up using some other test framework for my integration test.

---

<div class="post-metadata">

**Author:** ![kgish](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kgish/32/13333_2.png) [@kgish](https://discuss.emberjs.com/u/kgish)\
**Post date:** [January 25, 2015, 8:50am UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/7 "2015-01-25T08:50:32Z")

</div>

You say that the `click` is never called, try setting a breakpoint just before and see what happens by stepping through the code.

---

<div class="post-metadata">

**Author:** ![batman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/batman/32/268_2.png) [@batman](https://discuss.emberjs.com/u/batman)\
**Post date:** [January 26, 2015, 9:05pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/8 "2015-01-26T21:05:43Z")

</div>

yep did that…goes all the way to settimer code… but the timer is never executed…☹

---

<div class="post-metadata">

**Author:** ![kgish](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kgish/32/13333_2.png) [@kgish](https://discuss.emberjs.com/u/kgish)\
**Post date:** [January 26, 2015, 9:50pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/9 "2015-01-26T21:50:49Z")

</div>

What do you mean `settimer code`, don’t see that in your example.

Maybe you could share something on jsbin?

---

<div class="post-metadata">

**Author:** ![LevelbossMike](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/levelbossmike/32/14610_2.png) [@LevelbossMike](https://discuss.emberjs.com/u/LevelbossMike)\
**Post date:** [January 28, 2015, 7:12pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/10 "2015-01-28T19:12:18Z")

</div>

Do you have some kind of Ember.run.later thing that gets triggered in an interval? something for polling maybe? I had a similiar issue once which was caused by an Ember.run for a clock service. The async helper functions work in a way that they just wait for everything in the run loop to complete and if you have something that retriggers the runloop continiously the async helpers won’t resolve.

---

<div class="post-metadata">

**Author:** ![batman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/batman/32/268_2.png) [@batman](https://discuss.emberjs.com/u/batman)\
**Post date:** [January 28, 2015, 8:14pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/11 "2015-01-28T20:14:48Z")

</div>

yeah I had read about that issue. I am suspecting the same that some code of mine is triggering the run loop and its waiting forever. I did comment out one of the code but still no help. Will keep on debugging until I nail this down :).

---

<div class="post-metadata">

**Author:** ![batman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/batman/32/268_2.png) [@batman](https://discuss.emberjs.com/u/batman)\
**Post date:** [January 28, 2015, 8:15pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/12 "2015-01-28T20:15:50Z")

</div>

@kgish not possible. Sorry I meant setTimeout function that ember uses.

---

<div class="post-metadata">

**Author:** ![jcope2013](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/jcope2013/32/9878_2.png) [@jcope2013](https://discuss.emberjs.com/u/jcope2013)\
**Post date:** [January 29, 2015, 1:55am UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/13 "2015-01-29T01:55:09Z")

</div>

i am seeing something similar in ember-cli when i try to run an integration test, andThen or none of my executions/expectations don’t work, only the visit works

---

<div class="post-metadata">

**Author:** ![kgish](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kgish/32/13333_2.png) [@kgish](https://discuss.emberjs.com/u/kgish)\
**Post date:** [January 29, 2015, 9:42am UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/14 "2015-01-29T09:42:15Z")

</div>

[http://emberjs.com/guides/understanding-ember/debugging/#toc\_errors-within-an-code-rsvp-promise-code](http://emberjs.com/guides/understanding-ember/debugging/#toc_errors-within-an-code-rsvp-promise-code)

---

<div class="post-metadata">

**Author:** ![batman](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/batman/32/268_2.png) [@batman](https://discuss.emberjs.com/u/batman)\
**Post date:** [March 5, 2015, 6:55pm UTC](https://discuss.emberjs.com/t/integration-test-not-working/7140/15 "2015-03-05T18:55:10Z")

</div>

Sorry for replying late, was caught up in lot of work. I was able to figure out the issue. It was the sinon-qunit version which I was using creating issues with the promises I think. Upgrading to the latest fixed the issue.

@jcope2013 Check if any other libraries you recently added are creating such an issue.
