-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## **Description** Develop and implement a QR code-based system to enable secure and efficient connections between custodian accounts and the web extension, leveraging advanced encryption methods and API communication. https://www.loom.com/share/5968d1ab02894f88a1b4155cd1c55fe1?sid=58fc6793-4a82-4e79-b2ab-6bd81377d5df ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. - [x] I’ve properly set the pull request status: - [x] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com> Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net> Co-authored-by: António Regadas <apregadas@gmail.com>
- Loading branch information
1 parent
249d85b
commit 8d4e334
Showing
20 changed files
with
814 additions
and
108 deletions.
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.
This file contains 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 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 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 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 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 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 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 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,65 @@ | ||
import { type Page, type BrowserContext } from '@playwright/test'; | ||
import { test } from '../helpers/extension-loader'; | ||
import { ChromeExtensionPage } from '../pageObjects/mmi-extension-page'; | ||
import { MMIMainMenuPage } from '../pageObjects/mmi-mainMenu-page'; | ||
import { MMINetworkPage } from '../pageObjects/mmi-network-page'; | ||
import { MMISignUpPage } from '../pageObjects/mmi-signup-page'; | ||
import { MMIMainPage } from '../pageObjects/mmi-main-page'; | ||
import { MMIAccountMenuPage } from '../pageObjects/mmi-accountMenu-page'; | ||
import { CustodianTestClient } from '../custodian-hooks/hooks'; | ||
import { SEPOLIA_DISPLAY_NAME } from '../helpers/utils'; | ||
|
||
test.describe('QR Code Connection Request', () => { | ||
test('run the extension and add custodian accounts using the QR Code feature', async ({ | ||
page, | ||
context, | ||
}) => { | ||
const client = new CustodianTestClient(); | ||
await client.setup(); | ||
|
||
// Getting extension id of MMI | ||
const extensions = new ChromeExtensionPage(await context.newPage()); | ||
await extensions.goto(); | ||
await extensions.setDevMode(); | ||
const extensionId = await extensions.getExtensionId(); | ||
await extensions.close(); | ||
|
||
const signUp = new MMISignUpPage( | ||
await context.newPage(), | ||
extensionId as string, | ||
); | ||
await signUp.goto(); | ||
await signUp.start(); | ||
await signUp.authentication(); | ||
await signUp.info(); | ||
await signUp.close(); | ||
|
||
// Setup testnetwork in settings | ||
const mainMenuPage = new MMIMainMenuPage(page, extensionId as string); | ||
await mainMenuPage.goto(); | ||
await mainMenuPage.fillPassword(); | ||
await mainMenuPage.finishOnboarding(); | ||
await mainMenuPage.selectMenuOption('settings'); | ||
await mainMenuPage.selectSettings('Advance'); | ||
await mainMenuPage.switchTestNetwork(); | ||
await mainMenuPage.closeSettings(); | ||
|
||
// Check network | ||
const networkPage = new MMINetworkPage(page); | ||
await networkPage.open(); | ||
await networkPage.selectNetwork( | ||
process.env.MMI_E2E_TEST_NETWORK || SEPOLIA_DISPLAY_NAME, | ||
); | ||
|
||
// Get account from and to name | ||
const accountFrom = await client.getAccountFrom(); | ||
|
||
const accountsPopup = new MMIAccountMenuPage(page); | ||
await accountsPopup.accountsMenu(); | ||
await accountsPopup.connectCustodian('Neptune Custody', false, true); | ||
await accountsPopup.selectCustodyAccount(accountFrom); | ||
|
||
const mainPage = new MMIMainPage(page); | ||
await mainPage.bringToFront(); | ||
}); | ||
}); |
Binary file modified
BIN
+5.58 KB
(110%)
...i/specs/visual.spec.ts-snapshots/custodian-connection-info-mmi-visual-linux.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+466 Bytes
(100%)
test/e2e/mmi/specs/visual.spec.ts-snapshots/custodian-list-mmi-visual-linux.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 @@ | ||
export { default } from './qr-code-modal'; |
50 changes: 50 additions & 0 deletions
50
ui/components/institutional/qr-code-modal/qr-code-modal.stories.tsx
This file contains 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,50 @@ | ||
import React from 'react'; | ||
import { Meta, StoryFn } from '@storybook/react'; | ||
import { Provider } from 'react-redux'; | ||
import configureMockStore from 'redux-mock-store'; | ||
import QRCodeModal from './qr-code-modal'; | ||
|
||
const mockStore = configureMockStore(); | ||
const testData = { | ||
metamask: { | ||
institutionalFeatures: { | ||
channelId: 'channel123', | ||
connectionRequest: { | ||
payload: 'encryptedPayload', | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const store = mockStore(testData); | ||
|
||
const meta: Meta<typeof QRCodeModal> = { | ||
title: 'Components/QRCodeModal', | ||
decorators: [ | ||
(storyFn: any) => <Provider store={store}>{storyFn()}</Provider>, | ||
], | ||
component: QRCodeModal, | ||
argTypes: { | ||
onClose: { action: 'closed' }, | ||
custodianName: { control: 'text' }, | ||
custodianURL: { control: 'text' }, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
const Template: StoryFn<typeof QRCodeModal> = (args) => ( | ||
<QRCodeModal {...args} /> | ||
); | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
custodianName: 'Test Custodian', | ||
custodianURL: 'http://testcustodian.com', | ||
}; | ||
|
||
export const WithError = Template.bind({}); | ||
WithError.args = { | ||
...Default.args, | ||
error: 'Failed to load data', | ||
}; |
Oops, something went wrong.