mardi 8 mars 2016

Ember simple auth acceptance testing - session persistence

I'm trying to upgrade an Ember CLI app to use Simple Auth 1.0. I have configured the test suite to run against a Rails server which is a copy of my API.

In acceptance testing, my session seems to be lost when I click on a {{link-to}} element. I have a template like this:

{{#link-to 'route2' class='myLink'}}Go to route 2{{/link-to}}

And the following acceptance test:

visit("route1")
// Some code to log in here
equal(currentSession(application).get('isAuthenticated'), 1) // -> returns true
click(".myLink");
andThen(function(){
  equal(currentSession(application).get('isAuthenticated'), 1) // -> returns false
}

I wonder if this is related to the ephemeral session store which is the default in Ember Simple Auth 1.0. Am I doing this correctly or is there a better solution? This problem is only in testing - the app works fine in development/production environments.

Many thanks




Aucun commentaire:

Enregistrer un commentaire