So I have a simple acceptance test that asserts that a bunch of classes and elements are present if a user is considered to be on an “onboarding state”. In this case, having zero Document
records in the store will make the user needing to be onboarded.
We’re using fixtures, so the store is full of a bunch of Document
records. The second test seen below I want to clear the store of all Document
records before testing that the onboarding classes are applied. Unfortunately, store.unloadAll('document')
doesn’t appear to be working.
Can someone help me out? Using Ember CLI 0.1.1.
// tests/acceptance/document/onboarding-test.js
import moduleForApp from 'app/tests/helpers/module-for-app';
import Ember from 'ember';
var App;
moduleForApp('documents.index', 'User Onboarding Experience', {
setup: function() {
App = this.App;
}
});
test('There is no onboarding classes if user is onboarded', function() {
visit(this.url());
andThen(function() {
ok(
!find('.is-onboarding').length,
'There are no onboarding classes'
);
});
});
test('There are onboarding classes if user is not onboarded', function() {
Ember.run(function () {
App.__container__.lookup('store:main').unloadAll('document');
});
visit(this.url());
andThen(function() {
// this test fails, as the documents are in the store.
// The preview window in qunit confirms this, showing the list of documents
ok(
find('.is-onboarding').length,
'The onboarding classes are element'
);
});
});