Skip to content
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

feat: new receive flow #26148

Merged
merged 48 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
906284f
New receive flow
jonybur Jul 26, 2024
6be8c00
Add inner logo
jonybur Jul 26, 2024
8a21ffc
Merge branch 'develop' of github.com:MetaMask/metamask-extension into…
jonybur Aug 13, 2024
7c83dc7
Update snapshots
jonybur Aug 13, 2024
15ddce1
Add data test id
jonybur Aug 13, 2024
f4cfdbd
Merge branch 'develop' of github.com:MetaMask/metamask-extension into…
jonybur Aug 13, 2024
aa2bcd3
Update mock state
jonybur Aug 13, 2024
c67492a
Remove unused test
jonybur Aug 13, 2024
8df02d2
Remove unused test
jonybur Aug 13, 2024
afbf1a7
Remove test
jonybur Aug 13, 2024
ec0535c
Remove test
jonybur Aug 13, 2024
e70e745
Lint
jonybur Aug 13, 2024
86dd4bb
Merge branch 'develop' of github.com:MetaMask/metamask-extension into…
jonybur Aug 14, 2024
dd2f20e
Fix test
jonybur Aug 14, 2024
ba0dbc3
Remove unused import
jonybur Aug 14, 2024
fde5c94
Update snapshot
jonybur Aug 14, 2024
faf2a02
Fix import-flow
jonybur Aug 14, 2024
3763e6e
Remove unused string
jonybur Aug 14, 2024
cdaae30
Revert changes
jonybur Aug 14, 2024
a9dfed9
Fix tests
jonybur Aug 14, 2024
f025cae
Update match
jonybur Aug 14, 2024
e65b814
Fix selector
jonybur Aug 14, 2024
d57a519
Update address
jonybur Aug 14, 2024
2ef88c7
Fix incremental-security
jonybur Aug 15, 2024
14d7915
Limit public address size
jonybur Aug 15, 2024
6f238e9
Fix addresses
jonybur Aug 15, 2024
343bba6
Remove timeout
jonybur Aug 15, 2024
75dde9e
Revert fix
jonybur Aug 15, 2024
40880c0
Readd fix
jonybur Aug 15, 2024
385793f
wip - remove breaking test
jonybur Aug 15, 2024
0020760
Readd receive button
jonybur Aug 20, 2024
d5d6ba9
Update test
jonybur Aug 20, 2024
66c1421
Fix test
jonybur Aug 20, 2024
0ec27fc
Update tests
jonybur Aug 20, 2024
a008273
Remove unused method
jonybur Aug 20, 2024
c459576
Fix test
jonybur Aug 20, 2024
8b1b6da
Merge branch 'develop' into jb-receive-flow
jonybur Aug 20, 2024
1608274
Merge branch 'develop' into jb-receive-flow
jonybur Aug 20, 2024
c00bf73
Fix background color of QR code
jonybur Aug 21, 2024
ff6f902
Merge branch 'jb-receive-flow' of github.com:MetaMask/metamask-extens…
jonybur Aug 21, 2024
57abcd1
Fix lint
jonybur Aug 21, 2024
e0bdf44
Readd test
jonybur Aug 21, 2024
5ea0a07
Update ui/components/ui/qr-code-view/index.scss
jonybur Aug 21, 2024
0858533
Update ui/components/ui/qr-code-view/index.scss
jonybur Aug 21, 2024
75a7eae
Merge branch 'develop' of github.com:MetaMask/metamask-extension into…
jonybur Aug 21, 2024
3147f14
Remove unused CSS class
jonybur Aug 21, 2024
f1393da
Merge branch 'jb-receive-flow' of github.com:MetaMask/metamask-extens…
jonybur Aug 21, 2024
36fc160
Fix lint
jonybur Aug 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/en_GB/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/es/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/fr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/hi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/id/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ja/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ko/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/pt/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ru/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/tl/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/tr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/vi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/zh_CN/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/e2e/flask/btc/btc-account-overview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('BTC Account - Overview', function (this: Suite) {
assert.equal(await buySellButton.isEnabled(), false);

const portfolioButton = await driver.waitForSelector(
'[data-testid="coin-overview-portfolio"]',
'[data-testid="coin-overview-receive"]',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this spec is called has portfolio button enabled for BTC accounts however, here we are checking if the receive button is enabled (not the portfolio).
The portfolio link doesn't appear anymore. Is this expected? If so, the title for the test should be changed, otherwise we should open a bug, indicating that the portfolio link doesn't appear anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, PR to fix this:
#28184

);
assert.equal(await portfolioButton.isEnabled(), true);
},
Expand Down
37 changes: 1 addition & 36 deletions test/e2e/tests/account/import-flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const {
regularDelayMs,
largeDelayMs,
completeImportSRPOnboardingFlow,
completeImportSRPOnboardingFlowWordByWord,
openActionMenuAndStartSendFlow,
unlockWallet,
logInWithBalanceValidation,
Expand Down Expand Up @@ -61,7 +60,7 @@ describe('Import flow @no-mmi', function () {
await driver.clickElement(
'[data-testid="account-list-item-menu-button"]',
);
await driver.clickElement('[data-testid="account-list-menu-details"');
await driver.clickElement('[data-testid="account-list-menu-details"]');
await driver.findVisibleElement('.qr-code__wrapper');

// shows a QR code for the account
Expand Down Expand Up @@ -162,40 +161,6 @@ describe('Import flow @no-mmi', function () {
);
});

it('Import wallet using Secret Recovery Phrase with pasting word by word', async function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove this test

const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3';

await withFixtures(
{
fixtures: new FixtureBuilder({ onboarding: true }).build(),
ganacheOptions,
title: this.test.fullTitle(),
},
async ({ driver }) => {
await driver.navigate();

await completeImportSRPOnboardingFlowWordByWord(
driver,
TEST_SEED_PHRASE,
WALLET_PASSWORD,
);

// Show account information
await driver.clickElement('[data-testid="account-menu-icon"]');
await driver.clickElement(
'[data-testid="account-list-item-menu-button"]',
);
await driver.clickElement('[data-testid="account-list-menu-details"');
await driver.findVisibleElement('.qr-code__wrapper');
// shows the correct account address
await driver.findElement({
css: '.qr-code [data-testid="address-copy-button-text"]',
text: testAddress,
});
},
);
});

it('Import Account using private key and remove imported account', async function () {
const testPrivateKey1 =
'14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6';
Expand Down
7 changes: 3 additions & 4 deletions test/e2e/tests/account/incremental-security.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,10 @@ describe('Incremental Security', function () {
);
await driver.clickElement('[data-testid="account-list-menu-details"');

// gets the current accounts address
const address = await driver.findElement(
'.qr-code .multichain-address-copy-button',
const outerSegment = await driver.findElement(
'.qr-code__address-segments',
);
const publicAddress = await address.getText();
const publicAddress = await outerSegment.getText();

// wait for account modal to be visible
await driver.findVisibleElement(
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tests/portfolio/portfolio-site.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Portfolio site', function () {
await unlockWallet(driver);

// Click Portfolio site
await driver.clickElement('[data-testid="eth-overview-portfolio"]');
await driver.clickElement('[data-testid="portfolio-link"]');
await driver.waitUntilXWindowHandles(2);
const windowHandles = await driver.getAllWindowHandles();
await driver.switchToWindowWithTitle('E2E Test Page', windowHandles);
Expand Down
20 changes: 5 additions & 15 deletions ui/components/app/assets/asset-list/asset-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
DetectedTokensBanner,
TokenListItem,
ImportTokenLink,
ReceiveTokenLink,
} from '../../../multichain';
import { useAccountTotalFiatBalance } from '../../../../hooks/useAccountTotalFiatBalance';
import { useIsOriginalNativeTokenSymbol } from '../../../../hooks/useIsOriginalNativeTokenSymbol';
Expand Down Expand Up @@ -205,20 +204,11 @@ const AssetList = ({ onClickAsset, showTokensLinks }) => {
}}
/>
{shouldShowTokensLinks && (
<>
{balanceIsZero && (
<ReceiveTokenLink
margin={4}
marginBottom={0}
marginTop={detectedTokens.length > 0 ? 0 : 4}
/>
)}
<ImportTokenLink
margin={4}
marginBottom={2}
marginTop={detectedTokens.length > 0 && !balanceIsZero ? 0 : 2}
/>
</>
<ImportTokenLink
margin={4}
marginBottom={2}
marginTop={detectedTokens.length > 0 && !balanceIsZero ? 0 : 2}
/>
)}
{showDetectedTokens && (
<DetectedToken setShowDetectedTokens={setShowDetectedTokens} />
Expand Down
13 changes: 1 addition & 12 deletions ui/components/app/assets/asset-list/asset-list.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const USDC_CONTRACT = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
const LINK_CONTRACT = '0x514910771AF9Ca656af840dff83E8264EcF986CA';
const WBTC_CONTRACT = '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599';

let mockTokens = [
const mockTokens = [
{
address: USDC_CONTRACT,
decimals: 6,
Expand Down Expand Up @@ -134,15 +134,4 @@ describe('AssetList', () => {
expect(screen.getByText('Refresh list')).toBeInTheDocument();
});
});

it('shows the receive button when the user balance is zero', async () => {
mockTokens = [];

await act(async () => {
render(mockState.metamask.selectedAddress, '0x0', CHAIN_IDS.MAINNET);
});
await waitFor(() => {
expect(screen.getByText('Receive tokens')).toBeInTheDocument();
});
});
});
28 changes: 5 additions & 23 deletions ui/components/app/wallet-overview/btc-overview.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import configureMockStore from 'redux-mock-store';
import { fireEvent, waitFor } from '@testing-library/react';
import { fireEvent } from '@testing-library/react';
import thunk from 'redux-thunk';
import { Cryptocurrency } from '@metamask/assets-controllers';
import { BtcAccountType, BtcMethod } from '@metamask/keyring-api';
Expand All @@ -17,7 +17,7 @@ const PORTOFOLIO_URL = 'https://portfolio.test';

const BTC_OVERVIEW_BUY = 'coin-overview-buy';
const BTC_OVERVIEW_BRIDGE = 'coin-overview-bridge';
const BTC_OVERVIEW_PORTFOLIO = 'coin-overview-portfolio';
const BTC_OVERVIEW_RECEIVE = 'coin-overview-receive';
const BTC_OVERVIEW_SWAP = 'token-overview-button-swap';
const BTC_OVERVIEW_SEND = 'coin-overview-send';
const BTC_OVERVIEW_PRIMARY_CURRENCY = 'coin-overview__primary-currency';
Expand Down Expand Up @@ -218,27 +218,9 @@ describe('BtcOverview', () => {
});
});

it('always show the Portfolio button', () => {
it('always show the Receive button', () => {
const { queryByTestId } = renderWithProvider(<BtcOverview />, getStore());
const portfolioButton = queryByTestId(BTC_OVERVIEW_PORTFOLIO);
expect(portfolioButton).toBeInTheDocument();
});

it('open the Portfolio URI when clicking on Portfolio button', async () => {
const { queryByTestId } = renderWithProvider(<BtcOverview />, getStore());
const openTabSpy = jest.spyOn(global.platform, 'openTab');

const portfolioButton = queryByTestId(BTC_OVERVIEW_PORTFOLIO);
expect(portfolioButton).toBeInTheDocument();
fireEvent.click(portfolioButton as HTMLElement);

expect(openTabSpy).toHaveBeenCalledTimes(1);
await waitFor(() =>
expect(openTabSpy).toHaveBeenCalledWith({
url: expect.stringContaining(
`?metamaskEntry=ext_portfolio_button&metametricsId=${mockMetaMetricsId}`,
),
}),
);
const receiveButton = queryByTestId(BTC_OVERVIEW_RECEIVE);
expect(receiveButton).toBeInTheDocument();
});
});
Loading