Comments (11)
Since I arrived with this exact same problem, I believe I can provide more info for future visitors, even knowing that this issue has already been addressed.
Most of the actions that Ember.testing executes (like visit
) will append to a promise that gets executed action after action in the right order. In order to pass to the next action, Ember.testing makes sure that there is nothing pending, so that the step can be considered complete and move forward.
Along with the things that are tested for, pending AJAX requests are verified, and also scheduled timers. These timers may arise from, you guessed it, Ember.run.later
calls. If for any reason you would have in your code periodic Ember.run.later
methods (so that one is always waiting to be excuted), it's likely that you'll face this issue.
I've faced it myself in a similar scenario: My server returns a OAuth access token with 100 hours until expired, so ember-simpleAuth registers a call close to the expiration time with Ember.run.later
to refresh the token. This will, however, prevent the test from moving along. My specific situations has been fixed in further versions but any similar behavior will reproduce the issue (which is likely a conclusion of the current design of Ember.testing).
Hope this helps to anyone with this issue, and sorry for the wall of text.
from ember-simple-auth.
It's a little hard to help without having access to the code. Accessing the login route shouldn't actually trigger anything in Ember.SimpleAuth though. Also I'm not sure which init function you're talking about.
As a side note (though I don't think that's causing your problem): routeAfterLogin
and routeAfterLogout
are supposed to be Ember route identifiers so you'd want to specify them as user.dashboard
and user.login
.
from ember-simple-auth.
I'm having the same issue and I've narrowed it down to a simple test case:
https://github.com/matthooks/ember-karma-simple-auth-issue
Run karma start
. With the initializer, the application hangs when visit() is called. Without it, everything runs fine.
from ember-simple-auth.
Looks like it's something to do with this line: https://github.com/simplabs/ember-simple-auth/blob/310abd1aea9f9b5254975c3f494fd59bfbc5ac9b/packages/ember-simple-auth/lib/session.js#L86
from ember-simple-auth.
I think the problem is the use of Ember.run.later somehow breaks testing. Probably best to disable it in testing mode...
from ember-simple-auth.
I'm still digging to figure out why that line is breaking things. The plugin seems to work fine without it. What's the intention of that run.later call?
from ember-simple-auth.
The syncProperties
method periodically re-reads the cookie to see changes in the stored values (e.g. for the case when you have 2 tabs open, logout in one and should be logged out in the 2nd one as well). I'll disable that in Ember testing mode, shouldn't have any effect on anything really...
from ember-simple-auth.
Hello and thank you. This problem has not been fixed, yet.
from ember-simple-auth.
@AlphaGit thanks for the great write up. Unfortunately just recognized it today. Should we disable automatic token refreshing in testing mode?
from ember-simple-auth.
@marcoow I think that's a fair approach. I don't think anyone would be relying on that feature for test scenarios.
from ember-simple-auth.
@AlphaGit +1 I have just hotfixed it by commenting the line while testing :)
from ember-simple-auth.
Related Issues (20)
- Deprecation: `old-deprecate-method-paths` HOT 1
- Ember Simple Auth: The automatic session initialization is deprecated on Ember 3.28.4 HOT 9
- Is Torii addon abandonned ? HOT 9
- Ember 4.1.0: Use of `assign` has been deprecated. Please use `Object.assign` or the spread operator instead. HOT 1
- Unhandled Promise error detected when using the manual session.setup function HOT 9
- When I logout of one tab the authenticated data still seems to be populated in another tab HOT 1
- React to authentication in a component via modifier HOT 2
- v2 addon format HOT 5
- Typescript error on accessing prohibitAuthentication HOT 3
- CookieStore is not initializing/syncing correctly HOT 2
- Dependency Dashboard
- CookieExpirationTime not being set HOT 2
- When syncing tabs (session store), schedule of the refresh token should be updated
- ember-polyfills.deprecate-assign deprication in Ember 4.4 HOT 2
- Action Required: Fix Renovate Configuration
- ESA's Application route hides host app's route when using pod layout & embroider HOT 5
- Access token does not persist HOT 1
- Neither of test apps work - did you stop maintaining it? HOT 1
- Missing deprecation guide for session events HOT 1
- test-app should use modern Octane syntax
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-simple-auth.