mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-18 15:33:21 +01:00
552ea136b7
The bug with our onboarding library integration was introduced in #8873 because of a change in when `completeOnboarding` was called. We hadn't realized at the time that the onboarding integration relied upon the onboarding completing event to know when the onboarding state should be cleared. Because onboarding is now marked as completed earlier, the state was cleared just as it was intended to be used. The onboarding completed event has been moved back to where it was before: after the user exits the "end of flow" page. The original problem that #8873 was addressing was a routing issue, where the user would be redirected back to the seed phrase confirmation page despite already having confirmed their seed phrase. This was fixed in a different way here, by updating the routing in the first time flow switch to skip straight to the end of flow page if the seed phrase has already been confirmed. This does involve one user-facing change in behavior; if the user opens any MetaMask UI before navigating away from the end-of-flow screen, they will still be considered mid-onboarding so it'll redirect to the end-of-flow screen. But we do mark onboarding as completed if the user closes the tab/window while on the end of flow screen, which was another goal of #8873.
36 lines
929 B
JavaScript
36 lines
929 B
JavaScript
import assert from 'assert'
|
|
import React from 'react'
|
|
import sinon from 'sinon'
|
|
import { mountWithRouter } from '../../../../../../test/lib/render-helpers'
|
|
import { DEFAULT_ROUTE } from '../../../../helpers/constants/routes'
|
|
import EndOfFlowScreen from '..'
|
|
|
|
describe('End of Flow Screen', function () {
|
|
let wrapper
|
|
|
|
const props = {
|
|
history: {
|
|
push: sinon.spy(),
|
|
},
|
|
setCompletedOnboarding: sinon.spy(),
|
|
}
|
|
|
|
beforeEach(function () {
|
|
wrapper = mountWithRouter(<EndOfFlowScreen.WrappedComponent {...props} />)
|
|
})
|
|
|
|
it('renders', function () {
|
|
assert.equal(wrapper.length, 1)
|
|
})
|
|
|
|
it('should navigate to the default route on click', function (done) {
|
|
const endOfFlowButton = wrapper.find('.btn-primary.first-time-flow__button')
|
|
endOfFlowButton.simulate('click')
|
|
|
|
setImmediate(() => {
|
|
assert(props.history.push.calledOnceWithExactly(DEFAULT_ROUTE))
|
|
done()
|
|
})
|
|
})
|
|
})
|