I'm hoping to get some clues about why I have intermittent test failures. I have an acceptance test that fails when I run the entire module, but all of the individual tests pass when they are run alone. The issue seems to have something to do with using a loop around assertions because I have two different tests that fail and both have a forEach loop something like this:
import Ember from 'ember';
import { module, test } from 'qunit';
import startApp from "dwellconnect-app/tests/helpers/start-app";
var things;
module('Acceptance | something', {
beforeEach: function() {
this.application = startApp();
things = [
Ember.Object({someProperty: '1'}),
Ember.Object({someProperty: '2'}),
Ember.Object({someProperty: '3'}),
Ember.Object({someProperty: '4'}),
]
},
afterEach: function() {
Ember.run(this.application, 'destroy');
}
});
test('Something', function(assert) {
assert.expect(5);
visit('/something');
andThen(function() {
// Check that each thing is on the page
things.forEach(function(thing) {
var someSelector = 'span:contains("' + thing.someProperty + '")';
assert.equal(find(someSelector).length, 1, 'Shows each thing');
});
});
});
First of all, is there something wrong with this approach and if so, what is the correct way to build a set of assertions around an array of data. If not, what else could be causing the issue? Even if you can only provide possible scenarios for intermittent failures, it might lead me in the right direction. Right now there are no errors and this is making me crazy. I'm not sure Sherlock Holmes could find this one.
Aucun commentaire:
Enregistrer un commentaire