Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] [Bug] App does not 'settle' after login in acceptance test #239

Closed
niranjan94 opened this issue Jun 16, 2018 · 5 comments
Closed

[4.x] [Bug] App does not 'settle' after login in acceptance test #239

niranjan94 opened this issue Jun 16, 2018 · 5 comments

Comments

@niranjan94
Copy link

After upgrading ember-simple-auth-token to 4.0.2 from 3.0.0, we are facing a weird issue. In our acceptance tests, after login, the app does not reach a settlled state.

A call to getSettledState gives the following response

{
  hasPendingTimers    : true,
  hasRunLoop          : false,
  hasPendingWaiters   : false,
  hasPendingRequests  : false,
  pendingRequestCount : 0
}

This causing the test suite to just freeze since the promise never resolves. (As it is still waiting for the app to settle down).


I have created an isolated application and a test case that shows this very clearly.

Application: https://github.com/niranjan94/token-settle-test

Test case:
https://github.com/niranjan94/token-settle-test/blob/f1fe3393b91f25c2b7b36e4e72258553c3074562/tests/acceptance/failure-case-test.js#L1-L18

@fenichelar
Copy link
Owner

This was a fun one but I figured it out! scheduleAccessTokenExpiration schedules the session invalidation based on the expiration of the token which is why the app is never settled. You can confirm this by commenting out this line: https://github.com/jpadilla/ember-simple-auth-token/blob/master/addon/authenticators/jwt.js#L338. I'm not sure what the solution for this is. Using a token with a short expiration is one option but not ideal.

@fenichelar
Copy link
Owner

@jpadilla Thoughts?

@niranjan94
Copy link
Author

niranjan94 commented Jun 18, 2018

Using a token with a short expiration is one option but not ideal.

That would be correct. Since we want to test the app when the token is valid too. Maybe there could be a config flag that turns off automated expiration handling of tokens. That way, for testing, we could just turn it off since the tokens we use are anyway short-lived dummy tokens.

@fenichelar
Copy link
Owner

Maybe there could be a config flag that turns off automated expiration handling of tokens.

Config flag added in #235

@knownasilya
Copy link
Contributor

This was not easy to track down..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants