Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot get async test to work #209

Closed
deepflame opened this issue Nov 13, 2015 · 2 comments
Closed

cannot get async test to work #209

deepflame opened this issue Nov 13, 2015 · 2 comments

Comments

@deepflame
Copy link

Hi guys,

I am trying to get an async test to work. No luck so far.

I tried using:

  • assert.async (example below)
  • Qunit.start(), Qunit.stop()
  • returning a promise (example below)
test('it provides autocompletion', function(assert) {
  assert.expect(1);
  var done = assert.async(1);

  this.render(hbs`{{company-input}}`);

  this.$('.tt-input').typeahead('val', 'Goog');

  setTimeout(function() {
    assert.equal(this.$('.tt-menu').text().trim(), 'Google'); // gets autocompletion
    done();
  }, 500 );
});
test('it provides autocompletion', function(assert) {
  assert.expect(2);

  this.render(hbs`{{company-input}}`);

  this.$('.tt-input').typeahead('val', 'Goog');

  return new RSVP.Promise(function(resolve, reject) {
    setTimeout(function() {
      assert.equal(this.$('.tt-menu').text().trim(), 'Google'); // gets autocompletion
      resolve();
    }, 500 );
  });
});

When I run it as a single test it is fine, but when I run the whole suite it fails...

Any help is highly appreciated!

@fivetanley
Copy link
Member

I think this is likely something with Twitter typeahead. We had similar issues testing it when we used it on a client project. Does increasing the timeout from 500 to something greater help?

@Turbo87
Copy link
Member

Turbo87 commented Oct 14, 2017

closing due to inactivity

@Turbo87 Turbo87 closed this as completed Oct 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants