afterEach: signOut is not a function


#1

For my acceptance tests I have created a very simple async test helper for logging out the user if logged in:

// tests/helpers/sign-out.js
import Ember from 'ember';

export default Ember.Test.registerHelper('signOut', function(/*app*/) {
    if (find('#navigation-logout').length === 1) {
        click('#navigation-logout');
    }
});

I would like it to be called in the afterEach hook like this:

moduleForAcceptance('Acceptance | Admin | ...', {
    beforeEach: function() {
        signinAdmin();
    },
    afterEach: function() {
        signOut();
    }
});

However my test fails with the following error message:

afterEach failed on Admin can access the profile page from dashboard: signOut is not a function

Putting it in the beforeEach hook works fine, and moving signinAdmin() to the afterEach hook gives the same problem.

Any ideas what I’m doing wrong and how to fix?