-
Couldn't load subscription status.
- Fork 5.4k
fix: added skip modal for create wallet using SRP #37224
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
Closed
+404
−40
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0a86fcf
fix: added skip modal for create wallet using SRP
smgv f7247b5
Merge branch 'main' into fix/added-skip-modal
smgv e2131b2
Merge branch 'main' into fix/added-skip-modal
smgv ef5cd09
fix: updated e2e test cases
smgv 93f9e7f
fix: unused import lint error
smgv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
ui/pages/onboarding-flow/recovery-phrase/__snapshots__/skip-srp-backup-popover.test.tsx.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`SkipSRPBackup should match snapshot 1`] = `<div />`; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
ui/pages/onboarding-flow/recovery-phrase/skip-srp-backup-popover.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| import React from 'react'; | ||
| import { fireEvent, waitFor } from '@testing-library/react'; | ||
| import configureMockStore from 'redux-mock-store'; | ||
| import thunk from 'redux-thunk'; | ||
| import { renderWithProvider } from '../../../../test/lib/render-helpers-navigate'; | ||
| import * as browserRuntime from '../../../../shared/modules/browser-runtime.utils'; | ||
| import { | ||
| PLATFORM_FIREFOX, | ||
| PLATFORM_CHROME, | ||
| } from '../../../../shared/constants/app'; | ||
| import { FirstTimeFlowType } from '../../../../shared/constants/onboarding'; | ||
| import { | ||
| ONBOARDING_COMPLETION_ROUTE, | ||
| ONBOARDING_METAMETRICS, | ||
| } from '../../../helpers/constants/routes'; | ||
| import SkipSRPBackup from './skip-srp-backup-popover'; | ||
|
|
||
| const mockNavigate = jest.fn(); | ||
|
|
||
| jest.mock('react-router-dom-v5-compat', () => { | ||
| return { | ||
| ...jest.requireActual('react-router-dom-v5-compat'), | ||
| useNavigate: () => mockNavigate, | ||
| }; | ||
| }); | ||
|
|
||
| describe('SkipSRPBackup', () => { | ||
| const mockStore = { | ||
| metamask: { | ||
| firstTimeFlowType: FirstTimeFlowType.create, | ||
| networkConfigurationsByChainId: { | ||
| '0x1': { | ||
| chainId: '0x1', | ||
| name: 'Ethereum Mainnet', | ||
| nativeCurrency: 'ETH', | ||
| defaultRpcEndpointIndex: 0, | ||
| rpcEndpoints: [ | ||
| { | ||
| type: 'custom', | ||
| url: 'https://mainnet.infura.io', | ||
| networkClientId: 'mainnet', | ||
| }, | ||
| ], | ||
| blockExplorerUrls: [], | ||
| }, | ||
| }, | ||
| selectedNetworkClientId: 'mainnet', | ||
| networksMetadata: { | ||
| mainnet: { | ||
| EIPS: { 1559: true }, | ||
| status: 'available', | ||
| }, | ||
| }, | ||
| internalAccounts: { | ||
| accounts: { | ||
| accountId: { | ||
| address: '0x0000000000000000000000000000000000000000', | ||
| metadata: { | ||
| keyring: 'HD Key Tree', | ||
| }, | ||
| }, | ||
| }, | ||
| selectedAccount: 'accountId', | ||
| }, | ||
| keyrings: [ | ||
| { | ||
| type: 'HD Key Tree', | ||
| accounts: ['0x0000000000000000000000000000000000000000'], | ||
| }, | ||
| ], | ||
| }, | ||
| localeMessages: { | ||
| currentLocale: 'en', | ||
| }, | ||
| }; | ||
|
|
||
| const store = configureMockStore([thunk])(mockStore); | ||
|
|
||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('should match snapshot', () => { | ||
| const { container } = renderWithProvider( | ||
| <SkipSRPBackup onClose={jest.fn()} secureYourWallet={jest.fn()} />, | ||
| store, | ||
| ); | ||
| expect(container).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it('should navigate to onboarding metametrics when skip is confirmed on non-Firefox browser', async () => { | ||
| jest | ||
| .spyOn(browserRuntime, 'getBrowserName') | ||
| .mockReturnValue(PLATFORM_CHROME); | ||
|
|
||
| const { getByTestId } = renderWithProvider( | ||
| <SkipSRPBackup onClose={jest.fn()} secureYourWallet={jest.fn()} />, | ||
| store, | ||
| ); | ||
|
|
||
| const checkbox = getByTestId('skip-srp-backup-checkbox'); | ||
| expect(checkbox).toBeInTheDocument(); | ||
|
|
||
| const confirmSkip = getByTestId('skip-srp-backup-button'); | ||
| expect(confirmSkip).toBeInTheDocument(); | ||
| expect(confirmSkip).toBeDisabled(); | ||
|
|
||
| fireEvent.click(checkbox); | ||
|
|
||
| await waitFor(() => { | ||
| expect(confirmSkip).toBeEnabled(); | ||
| }); | ||
|
|
||
| fireEvent.click(confirmSkip); | ||
|
|
||
| await waitFor(() => { | ||
| expect(mockNavigate).toHaveBeenCalledWith(ONBOARDING_METAMETRICS); | ||
| }); | ||
| }); | ||
|
|
||
| it('should navigate to onboarding completion when skip is confirmed on Firefox', async () => { | ||
| jest | ||
| .spyOn(browserRuntime, 'getBrowserName') | ||
| .mockReturnValue(PLATFORM_FIREFOX); | ||
|
|
||
| const { getByTestId } = renderWithProvider( | ||
| <SkipSRPBackup onClose={jest.fn()} secureYourWallet={jest.fn()} />, | ||
| store, | ||
| ); | ||
|
|
||
| const checkbox = getByTestId('skip-srp-backup-checkbox'); | ||
| expect(checkbox).toBeInTheDocument(); | ||
|
|
||
| const confirmSkip = getByTestId('skip-srp-backup-button'); | ||
| expect(confirmSkip).toBeInTheDocument(); | ||
| expect(confirmSkip).toBeDisabled(); | ||
|
|
||
| fireEvent.click(checkbox); | ||
|
|
||
| await waitFor(() => { | ||
| expect(confirmSkip).toBeEnabled(); | ||
| }); | ||
|
|
||
| fireEvent.click(confirmSkip); | ||
|
|
||
| await waitFor(() => { | ||
| expect(mockNavigate).toHaveBeenCalledWith(ONBOARDING_COMPLETION_ROUTE); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: SkipSRPBackup Snapshot Missing Modal Content
The snapshot for SkipSRPBackup shows only
<div />, which indicates the component is not rendering its modal content (Icon, Text, Checkbox, Buttons, etc.). This is a broken snapshot that doesn't validate the actual component output. The snapshot should contain the full Modal structure with ModalOverlay, ModalContent, ModalHeader with Icon and Text, Checkbox, and Button elements.