visit() throws TransitionAborted error
See original GitHub issueAs discussed in Slack, I was unexpectedly seeing failing tests where a transition was aborted.
ApplicationInstance#visit
is throwing it here
As I said I cannot share the app, but this is the human readable test spec (we have a rather exotic test setup with ember-cli-yadda
😉):
Scenario: Access restricted page as invited user and login
Given there exists a user with username "testname" and password "testpw"
And I am an invited user
And I am on the homepage
When I go to the user profile page
Then I should still be on the homepage
And I should see the login modal
When I insert "testname" as the username
And I insert "testpw" as the password
And I submit the login form
Then I should be on the user profile page
The I go to the user profile page
step is throwing the exception, which is calling visit('/user/profile')
internally.
I quickly assembled this little repro, that resembles what we were doing in a very minimal way: https://github.com/simonihmig/ember-visit-transition-abort
All the acceptance tests are passing, with the exception of this last one: https://github.com/simonihmig/ember-visit-transition-abort/blob/master/tests/acceptance/auth-test.js#L36-L40
Issue Analytics
- State:
- Created 6 years ago
- Reactions:16
- Comments:39 (15 by maintainers)
Top Results From Across the Web
Ember TransitionAborted when performing a full route ...
If you click the "Change it" button, you'll see a TransitionAborted error thrown in the console. I've been trying to upgrade Ember in...
Read more >TransitionAborted when performing a full route transition ...
If you click the “Change it” button, you'll see a TransitionAborted error thrown in the console. I've been trying to upgrade Ember in...
Read more >TransitionAborted should be a subclass of Error, not a POJO
Ember throws TransitionAborted objects as errors, but their API is inconsistent with Error (e. g. no stack property and .toString() is ridiculously ...
Read more >Ng1_state_events - UI-Router
An event broadcast on $rootScope when an error occurs during transition. ... from transitionTo() will be rejected with a 'transition aborted' error.
Read more >Heroku Connect Log Messages and Common Errors
This article documents some of the errors and messages you see in those logs. For information about Heroku External Objects logging, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just to check in here, I’ve been trying to track down exactly what is going on and I think I have a fairly good picture. Essentially what is happening is that the secondary transition completes during the
beforeModel
/model
/afterModel
of the first one, and since the full secondary transition has completed the router’s error handling throws this error instead of entangling the new transition with it like we do when there is an active transition.Ultimately, returning anything other than the actual resulting
Transition
object will cause the error reported here to bubble up. This includes making any of thebeforeModel
/model
/afterModel
methods themselves async (because then you are returning aPromise
not aTransition
), or returning anRSVP.Promise
that later resolves to aTransition
(e.g.return this.store.findRecord('post', 1).then((record) => if (record.whatever) { return this.transitionTo(...); }
).I know this is what folks were reporting all along, but now I actually understand it 😩. Sorry for taking so long to dig in here. I’m trying to work up a solution using @sethphillips’s reproduction.
I am also experiencing this issue when migrating our test suite (
Ember 2.17
&ember-cli-qunit ^4.1.1
)We are using
transition.abort
andtransition.retry
to handle route authentication at the route level as suggested on the Preventing and Retrying Transitions guide.Based on @NullVoxPopuli guidance, our current workaround has been to implement a wrapper of the
visit
helper: