lundi 6 juillet 2015

Page not loaded when visit helper resolves

I have a test that simply checks if a page has text after following a link. However, the page hasn't loaded by the time the QUnit visit helper resolves.

This is the test:

test('displays "Heatmap" in title when following a link in the heatmap', function(assert) {
  visit('/view/heatmap');
  click('.heatmap a:eq(0)'); // Error: Element .heatmap a:eq(0) not found.

  andThen(function() {
    assert.equal(find('.home-title').text(), 'Heatmap');
  });
});

If I comment out the click helper and put a breakpoint in the andThen, the page is still loading.

My first thought is that the route is causing the issue, but I'm not sure why this would be the case. Here's the route:

export default Ember.Route.extend({
  model: function() {
    var store = this.store;
    return Ember.RSVP.hash({
      foo: store.find('foo'),
      bar: store.fetchAll('bar'),
      baz: store.fetchAll('baz')
    });
  }
});

Also, the template uses ember-table in order to render the heatmap. Could that cause the issue?

Versions:

ember -v

version: 0.2.7
node: 0.12.5
npm: 2.11.0

bower list | grep qunit
├── ember-qunit#0.4.1
├─┬ ember-qunit-notifications#0.0.7
│ └── qunit-notifications#0.0.6
├── qunit#1.17.1 (latest is 1.18.0)

I should also mention that this test worked before a couple of upgrades. It was written when the app was using Ember CLI version 0.2.3, and it stopped working sometime between then and now.




Aucun commentaire:

Enregistrer un commentaire