Integration test not working


#1

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. :frowning:

 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');
    });    
});

#2

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


#3

Try the following format instead and see if that helps.

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

#4

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


#5

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


#6

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. :frowning: I might end up using some other test framework for my integration test.


#7

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


#8

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


#9

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

Maybe you could share something on jsbin?


#10

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.


#11

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 :).


#12

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


#13

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


#14

http://emberjs.com/guides/understanding-ember/debugging/#toc_errors-within-an-code-rsvp-promise-code


#15

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.