GithubHelp home page GithubHelp logo

Comments (11)

AlphaGit avatar AlphaGit commented on May 22, 2024 1

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.

marcoow avatar marcoow commented on May 22, 2024

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.

matthooks avatar matthooks commented on May 22, 2024

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.

matthooks avatar matthooks commented on May 22, 2024

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.

marcoow avatar marcoow commented on May 22, 2024

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.

matthooks avatar matthooks commented on May 22, 2024

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.

marcoow avatar marcoow commented on May 22, 2024

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.

fibigerg avatar fibigerg commented on May 22, 2024

Hello and thank you. This problem has not been fixed, yet.

from ember-simple-auth.

marcoow avatar marcoow commented on May 22, 2024

@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.

AlphaGit avatar AlphaGit commented on May 22, 2024

@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.

fibigerg avatar fibigerg commented on May 22, 2024

@AlphaGit +1 I have just hotfixed it by commenting the line while testing :)

from ember-simple-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.