diff --git a/ui/pages/confirmations/send/send-content/add-recipient/domain-input.component.js b/ui/pages/confirmations/send/send-content/add-recipient/domain-input.component.js
index bb6e432f1a5d..1496f8251812 100644
--- a/ui/pages/confirmations/send/send-content/add-recipient/domain-input.component.js
+++ b/ui/pages/confirmations/send/send-content/add-recipient/domain-input.component.js
@@ -126,7 +126,10 @@ export default class DomainInput extends Component {
>
{hasSelectedAddress ? (
<>
-
+
Date: Tue, 2 Jul 2024 12:27:24 +0200
Subject: [PATCH 05/10] fix: page object selector not found (#25624)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## **Description**
The e2e that are using page objects are failing due to this error:
`Waiting for element to be located By(xpath, .//*[contains(concat(' ',
normalize-space(./@class), ' '), ' unlock-page__title
')][(contains(string(.), 'Welcome back!') or contains(string(.),
'Welcomeback!'))])`.
It looks like the selector is not correct. This PR uses the data test id
to find the correct element.
Explanation: [this
PR](https://github.com/MetaMask/metamask-extension/pull/25227) removed
the css selector, and [this other
PR](https://github.com/MetaMask/metamask-extension/pull/25373)
implemented page objects with the old selector -possibly the last PR was
not updated, so the tests were green, but once the 2 have been merged,
now this selector is not found and fails in the subsequent branches
ci failure
[here](https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/90108/workflows/5d04a531-048a-40e8-87f2-1d4d02f51291/jobs/3338274/tests#failed-test-0)
[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25624?quickstart=1)
## **Related issues**
Fixes:
## **Manual testing steps**
1. Go to this page...
2.
3.
## **Screenshots/Recordings**
![Screenshot from 2024-07-02
11-48-09](https://github.com/MetaMask/metamask-extension/assets/54408225/faf2a546-d8af-4ed2-884c-85c836994d86)
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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.
---
test/e2e/page-objects/pages/login-page.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/e2e/page-objects/pages/login-page.ts b/test/e2e/page-objects/pages/login-page.ts
index 2a3145ccdab5..b96600675040 100644
--- a/test/e2e/page-objects/pages/login-page.ts
+++ b/test/e2e/page-objects/pages/login-page.ts
@@ -14,7 +14,7 @@ class LoginPage {
this.passwordInput = '[data-testid="unlock-password"]';
this.unlockButton = '[data-testid="unlock-submit"]';
this.welcomeBackMessage = {
- css: '.unlock-page__title',
+ css: '[data-testid="unlock-page-title"]',
text: 'Welcome back!',
};
}
From 03fc8a9d0d9267ed3dca9bd7a81c42936a110d56 Mon Sep 17 00:00:00 2001
From: chloeYue <105063779+chloeYue@users.noreply.github.com>
Date: Tue, 2 Jul 2024 12:29:33 +0200
Subject: [PATCH 06/10] chore: [Delivery] Update author mapping list for PR
(#25606)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## **Description**
Update author team mapping list for PR
[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25606?quickstart=1)
## **Related issues**
Fixes:
## **Manual testing steps**
Check new authur/team mapping
## **Screenshots/Recordings**
### **Before**
### **After**
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [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.
## **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.
---
development/generate-rc-commits.js | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/development/generate-rc-commits.js b/development/generate-rc-commits.js
index 4de83ccaebce..a09103c35db9 100644
--- a/development/generate-rc-commits.js
+++ b/development/generate-rc-commits.js
@@ -49,17 +49,16 @@ const authorTeams = {
'Niranjana Binoy',
'Victor Thomas',
'vthomas13',
+ 'seaona',
+ 'Norbert Elter',
],
- DappAPI: ['tmashuang', 'jiexi', 'BelfordZ', 'Shane'],
- 'Confirmation UX': [
+ 'Wallet API': ['tmashuang', 'jiexi', 'BelfordZ', 'Shane'],
+ Confirmations: [
'Pedro Figueiredo',
'Sylva Elendu',
'Olusegun Akintayo',
'Jyoti Puri',
'Ariella Vu',
- 'seaona',
- ],
- 'Confirmation Systems': [
'OGPoyraz',
'vinistevam',
'Matthew Walsh',
@@ -67,8 +66,14 @@ const authorTeams = {
'Vinicius Stevam',
'Derek Brans',
'sleepytanya',
+ 'Priya',
+ ],
+ 'Design Systems': [
+ 'georgewrmarshall',
+ 'Garrett Bear',
+ 'George Marshall',
+ 'Devin',
],
- 'Design Systems': ['georgewrmarshall', 'Garrett Bear', 'George Marshall'],
Snaps: [
'David Drazic',
'hmalik88',
@@ -84,7 +89,7 @@ const authorTeams = {
Assets: ['salimtb', 'sahar-fehri', 'Brian Bergeron'],
Linea: ['VGau', 'Victorien Gauch'],
lavamoat: ['weizman', 'legobeat', 'kumavis', 'LeoTM'],
- 'Shared Libraries': [
+ 'Wallet Framework': [
'Michele Esposito',
'Elliot Winkler',
'Gudahtt',
@@ -98,10 +103,11 @@ const authorTeams = {
'Shane T',
'Bernardo Garces Chapero',
],
- Swaps: ['Daniel', 'Davide Brocchetto', 'Nicolas Ferro'],
+ Swaps: ['Daniel', 'Davide Brocchetto', 'Nicolas Ferro', 'infiniteflower'],
Devex: ['Thomas Huang', 'Alex Donesky', 'jiexi', 'Zachary Belford'],
Notifications: ['Prithpal-Sooriya', 'Matteo Scurati', 'Prithpal Sooriya'],
- Bridging: ['Bilal', 'micaelae'],
+ Bridging: ['Bilal', 'micaelae', 'Ethan Wessel'],
+ Ramps: ['George Weiler'],
};
// Function to get PR labels
From d721e7f7b1d7a915624fb14050a8b4037c524d96 Mon Sep 17 00:00:00 2001
From: Monte Lai
Date: Tue, 2 Jul 2024 20:17:29 +0800
Subject: [PATCH 07/10] fix: account missing in connection page (#25500)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## **Description**
This PR fixes a regression where the connected account is not showing up
on the page.
## **Related issues**
## **Manual testing steps**
1. Go to a test dapp
2. Connect the account
3. Open the popup
4. Click on the connection icon and see the connected account.
## **Screenshots/Recordings**
### **Before**
### **After**
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [ ] 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.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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: Nidhi Kumari
Co-authored-by: Charly Chevalier
---
test/e2e/helpers.js | 9 +++++
.../tests/multichain/connection-page.spec.js | 33 +++++++++++++++++++
.../account-list-item.test.js.snap | 2 ++
.../account-list-item/account-list-item.js | 6 +++-
.../app-header-unlocked-content.tsx | 2 ++
.../connected-site-menu.js | 2 +-
.../__snapshots__/connections.test.tsx.snap | 1 +
.../send/__snapshots__/send.test.js.snap | 1 +
.../__snapshots__/your-accounts.test.tsx.snap | 6 ++++
.../remove-snap-account.test.js.snap | 1 +
10 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js
index 226fe4f9f6ac..dbdfdeb2446d 100644
--- a/test/e2e/helpers.js
+++ b/test/e2e/helpers.js
@@ -675,6 +675,14 @@ const openDapp = async (driver, contract = null, dappURL = DAPP_URL) => {
: await driver.openNewPage(dappURL);
};
+const openDappConnectionsPage = async (driver) => {
+ await driver.openNewPage(
+ `${driver.extensionUrl}/home.html#connections/${encodeURIComponent(
+ DAPP_URL,
+ )}`,
+ );
+};
+
const createDappTransaction = async (driver, transaction) => {
await openDapp(
driver,
@@ -1158,6 +1166,7 @@ module.exports = {
importWrongSRPOnboardingFlow,
testSRPDropdownIterations,
openDapp,
+ openDappConnectionsPage,
createDappTransaction,
switchToOrOpenDapp,
connectToDapp,
diff --git a/test/e2e/tests/multichain/connection-page.spec.js b/test/e2e/tests/multichain/connection-page.spec.js
index e5594de82840..2d1d2f2d106c 100644
--- a/test/e2e/tests/multichain/connection-page.spec.js
+++ b/test/e2e/tests/multichain/connection-page.spec.js
@@ -183,4 +183,37 @@ describe('Connections page', function () {
},
);
});
+
+ // Skipped until issue where firefox connecting to dapp is resolved.
+ // it('shows that the account is connected to the dapp', async function () {
+ // await withFixtures(
+ // {
+ // dapp: true,
+ // fixtures: new FixtureBuilder().build(),
+ // title: this.test.fullTitle(),
+ // ganacheOptions: defaultGanacheOptions,
+ // },
+ // async ({ driver, ganacheServer }) => {
+ // const ACCOUNT = '0x5CfE73b6021E818B776b421B1c4Db2474086a7e1';
+ // const SHORTENED_ACCOUNT = shortenAddress(ACCOUNT);
+ // await logInWithBalanceValidation(driver, ganacheServer);
+ // await openDappConnectionsPage(driver);
+ // // Verify that there are no connected accounts
+ // await driver.assertElementNotPresent(
+ // '[data-testid="account-list-address"]',
+ // );
+
+ // await connectToDapp(driver);
+ // await openDappConnectionsPage(driver);
+
+ // const account = await driver.findElement(
+ // '[data-testid="account-list-address"]',
+ // );
+ // const accountAddress = await account.getText();
+
+ // // Dapp should contain single connected account address
+ // assert.strictEqual(accountAddress, SHORTENED_ACCOUNT);
+ // },
+ // );
+ // });
});
diff --git a/ui/components/multichain/account-list-item/__snapshots__/account-list-item.test.js.snap b/ui/components/multichain/account-list-item/__snapshots__/account-list-item.test.js.snap
index 0b2b13a29277..ae53a1353084 100644
--- a/ui/components/multichain/account-list-item/__snapshots__/account-list-item.test.js.snap
+++ b/ui/components/multichain/account-list-item/__snapshots__/account-list-item.test.js.snap
@@ -262,6 +262,7 @@ exports[`AccountListItem renders AccountListItem component and shows account nam
>
bc1qn3s...5eker
@@ -557,6 +558,7 @@ exports[`AccountListItem renders AccountListItem component and shows account nam
>
0x0DCD5...3E7bc
diff --git a/ui/components/multichain/account-list-item/account-list-item.js b/ui/components/multichain/account-list-item/account-list-item.js
index c3e09207cb7a..2b48bcb79baf 100644
--- a/ui/components/multichain/account-list-item/account-list-item.js
+++ b/ui/components/multichain/account-list-item/account-list-item.js
@@ -320,7 +320,11 @@ export const AccountListItem = ({
justifyContent={JustifyContent.spaceBetween}
>
-
+
{shortenAddress(normalizeSafeAddress(account.address))}
diff --git a/ui/components/multichain/app-header/app-header-unlocked-content.tsx b/ui/components/multichain/app-header/app-header-unlocked-content.tsx
index 0cca531b5fc1..2be2d5ffd342 100644
--- a/ui/components/multichain/app-header/app-header-unlocked-content.tsx
+++ b/ui/components/multichain/app-header/app-header-unlocked-content.tsx
@@ -41,6 +41,7 @@ import { GlobalMenu } from '../global-menu';
import {
getSelectedInternalAccount,
getTestNetworkBackgroundColor,
+ getOriginOfCurrentTab,
} from '../../../selectors';
import { getEnvironmentType } from '../../../../app/scripts/lib/util';
import { normalizeSafeAddress } from '../../../../app/scripts/lib/multichain/address';
@@ -80,6 +81,7 @@ export const AppHeaderUnlockedContent = ({
const t = useI18nContext();
const history = useHistory();
const dispatch = useDispatch();
+ const origin = useSelector(getOriginOfCurrentTab);
const [accountOptionsMenuOpen, setAccountOptionsMenuOpen] = useState(false);
const testNetworkBackgroundColor = useSelector(getTestNetworkBackgroundColor);
diff --git a/ui/components/multichain/connected-site-menu/connected-site-menu.js b/ui/components/multichain/connected-site-menu/connected-site-menu.js
index c7811b3e819c..4f532710288e 100644
--- a/ui/components/multichain/connected-site-menu/connected-site-menu.js
+++ b/ui/components/multichain/connected-site-menu/connected-site-menu.js
@@ -137,5 +137,5 @@ ConnectedSiteMenu.propTypes = {
/**
* Disable the connected site menu if the account is non-evm
*/
- disabled: PropTypes.boolean,
+ disabled: PropTypes.bool,
};
diff --git a/ui/components/multichain/pages/connections/__snapshots__/connections.test.tsx.snap b/ui/components/multichain/pages/connections/__snapshots__/connections.test.tsx.snap
index faa7a4fac173..3864de9c921e 100644
--- a/ui/components/multichain/pages/connections/__snapshots__/connections.test.tsx.snap
+++ b/ui/components/multichain/pages/connections/__snapshots__/connections.test.tsx.snap
@@ -317,6 +317,7 @@ exports[`Connections Content should render correctly 1`] = `
>
0x0DCD5...3E7bc
diff --git a/ui/components/multichain/pages/send/__snapshots__/send.test.js.snap b/ui/components/multichain/pages/send/__snapshots__/send.test.js.snap
index 59f5db9f8385..a3ee231d6ae2 100644
--- a/ui/components/multichain/pages/send/__snapshots__/send.test.js.snap
+++ b/ui/components/multichain/pages/send/__snapshots__/send.test.js.snap
@@ -489,6 +489,7 @@ exports[`SendPage render and initialization should render correctly even when a
>
0x0
diff --git a/ui/components/multichain/pages/send/components/__snapshots__/your-accounts.test.tsx.snap b/ui/components/multichain/pages/send/components/__snapshots__/your-accounts.test.tsx.snap
index 411ee70e4ea3..901e7def9c2c 100644
--- a/ui/components/multichain/pages/send/components/__snapshots__/your-accounts.test.tsx.snap
+++ b/ui/components/multichain/pages/send/components/__snapshots__/your-accounts.test.tsx.snap
@@ -265,6 +265,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
0x0DCD5...3E7bc
@@ -561,6 +562,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
0xEC1Ad...9251B
@@ -857,6 +859,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
0xc42ED...D8813
@@ -1162,6 +1165,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
0xeB9e6...64823
@@ -1458,6 +1462,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
0xb5526...FEe5D
@@ -1767,6 +1772,7 @@ exports[`SendPageYourAccounts render renders correctly 1`] = `
>
0xca8f1...Cf281
diff --git a/ui/pages/confirmations/confirmation/templates/__snapshots__/remove-snap-account.test.js.snap b/ui/pages/confirmations/confirmation/templates/__snapshots__/remove-snap-account.test.js.snap
index 7a411efb53ed..e0305e1c6533 100644
--- a/ui/pages/confirmations/confirmation/templates/__snapshots__/remove-snap-account.test.js.snap
+++ b/ui/pages/confirmations/confirmation/templates/__snapshots__/remove-snap-account.test.js.snap
@@ -361,6 +361,7 @@ exports[`remove-snap-account confirmation should match snapshot 1`] = `
>
0x0DCD5...3E7bc
From 4886a3ff5ce5b8da4c313b888b77b0ec47de93d5 Mon Sep 17 00:00:00 2001
From: seaona <54408225+seaona@users.noreply.github.com>
Date: Tue, 2 Jul 2024 14:18:46 +0200
Subject: [PATCH 08/10] chore: exclude running git diff job for the e2e quality
gate in `develop`, `master` and release branches (#25605)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## **Description**
This PR excludes running the git-diff script for the e2e quality gate
added
[here](https://github.com/MetaMask/metamask-extension/commit/3ea381d26963849a33d76d5b644c5f0044c9c778),
for `develop` as well as for `master` and release branches.
We don't want to run this in develop, master or release branch, since
there is no point on re-running the new/changed tests there, as the
changes are already in `develop` branch. This could add up more credits
and also slow down ci in those branches.
**Context**: in `develop` branch the current quality gate fails, since
the `diffResult` is empty, and we were throwing the following
[error](https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/89939/workflows/dccfb6e0-741d-4416-bc01-8ab1a884c12b/jobs/3329380)
as we were entering in the !diffResult condition.
However, this PR fixes the issue on the higher level, by skipping
entirely the git diff for the mentioned branches above.
```
await fetchUntilMergeBaseFound();
const { stdout: diffResult } = await exec(`git diff --name-only origin/HEAD...${process.env.CIRCLE_BRANCH}`);
if (!diffResult) {
throw new Error('Unable to get diff after full checkout.');
}
```
[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25605?quickstart=1)
## **Related issues**
Fixes: current develop ci
## **Manual testing steps**
- ci should continue to work
- once merged, fixes develop
## **Screenshots/Recordings**
### **Before**
### **After**
## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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.
---
.circleci/config.yml | 12 +++++++++---
test/e2e/changedFilesUtil.js | 2 +-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index d9f0754335e7..aaed8f3c8bf2 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -53,6 +53,13 @@ develop_master_rc_only: &develop_master_rc_only
- master
- /^Version-v(\d+)[.](\d+)[.](\d+)/
+exclude_develop_master_rc: &exclude_develop_master_rc
+ filters:
+ branches:
+ ignore:
+ - develop
+ - master
+ - /^Version-v(\d+)[.](\d+)[.](\d+)/
aliases:
# Shallow Git Clone
- &shallow-git-clone
@@ -106,6 +113,7 @@ workflows:
- check-pr-tag
- prep-deps
- get-changed-files-with-git-diff:
+ <<: *exclude_develop_master_rc
requires:
- prep-deps
- test-deps-audit:
@@ -203,7 +211,6 @@ workflows:
<<: *develop_master_rc_only
requires:
- prep-build-confirmation-redesign-test-mv2
- - get-changed-files-with-git-diff
- test-e2e-chrome-rpc:
requires:
- prep-build-test
@@ -223,7 +230,6 @@ workflows:
<<: *develop_master_rc_only
requires:
- prep-build-test-flask-mv2
- - get-changed-files-with-git-diff
- test-e2e-chrome-mmi:
requires:
- prep-build-test-mmi
@@ -243,7 +249,6 @@ workflows:
- /^Version-v(\d+)[.](\d+)[.](\d+)/
requires:
- prep-build
- - get-changed-files-with-git-diff
- test-unit-jest-main:
requires:
- prep-deps
@@ -488,6 +493,7 @@ jobs:
# This job is used for the e2e quality gate.
# It must be run before any job which uses the run-all.js script.
+ # The job is skipped in develop, master or RC branches.
get-changed-files-with-git-diff:
executor: node-browsers-small
steps:
diff --git a/test/e2e/changedFilesUtil.js b/test/e2e/changedFilesUtil.js
index 5ead76203db0..7beb7c94e9e7 100644
--- a/test/e2e/changedFilesUtil.js
+++ b/test/e2e/changedFilesUtil.js
@@ -20,7 +20,7 @@ async function readChangedFiles() {
return changedFiles;
} catch (error) {
console.error('Error reading from file:', error);
- return '';
+ return [];
}
}
From c6419813d24772e369f4e73ccad67c8e13abbf8d Mon Sep 17 00:00:00 2001
From: Mike B <32695229+plasmacorral@users.noreply.github.com>
Date: Tue, 2 Jul 2024 08:30:28 -0400
Subject: [PATCH 09/10] test: add e2e to swap with snap account (#25558)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## **Description**
[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25558?quickstart=1)
## **Related issues**
Fixes: [469](https://github.com/MetaMask/accounts-planning/issues/469)
## **Manual testing steps**
1. `yarn build:test:mv2` then `ENABLE_MV3=false yarn test:e2e:single
test/e2e/accounts/snap-account-eth-swap.spec.ts --browser=firefox`
2. `yarn build:test` then `yarn test:e2e:single
test/e2e/accounts/snap-account-eth-swap.spec.ts --browser=chrome`
## **Screenshots/Recordings**
### **Before**
### **After**
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] 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.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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.
---
.../accounts/snap-account-eth-swap.spec.ts | 48 +++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 test/e2e/accounts/snap-account-eth-swap.spec.ts
diff --git a/test/e2e/accounts/snap-account-eth-swap.spec.ts b/test/e2e/accounts/snap-account-eth-swap.spec.ts
new file mode 100644
index 000000000000..bb4c3c7a5770
--- /dev/null
+++ b/test/e2e/accounts/snap-account-eth-swap.spec.ts
@@ -0,0 +1,48 @@
+import { withFixtures, defaultGanacheOptions, WINDOW_TITLES } from '../helpers';
+import { Driver } from '../webdriver/driver';
+import FixtureBuilder from '../fixture-builder';
+import {
+ buildQuote,
+ reviewQuote,
+ waitForTransactionToComplete,
+ checkActivityTransaction,
+} from '../tests/swaps/shared';
+import { installSnapSimpleKeyring } from './common';
+
+const DAI = 'DAI';
+const TEST_ETH = 'TESTETH';
+
+describe('Snap Account - Swap', function () {
+ it('swaps ETH for DAI using a snap account', async function () {
+ await withFixtures(
+ {
+ fixtures: new FixtureBuilder().build(),
+ ganacheOptions: defaultGanacheOptions,
+ title: this.test?.fullTitle(),
+ },
+ async ({ driver }: { driver: Driver }) => {
+ await installSnapSimpleKeyring(driver, false);
+ await driver.switchToWindowWithTitle(
+ WINDOW_TITLES.ExtensionInFullScreenView,
+ );
+ await buildQuote(driver, {
+ amount: 0.001,
+ swapTo: DAI,
+ });
+ await reviewQuote(driver, {
+ amount: 0.001,
+ swapFrom: TEST_ETH,
+ swapTo: DAI,
+ });
+ await driver.clickElement({ text: 'Swap', tag: 'button' });
+ await waitForTransactionToComplete(driver, { tokenName: 'DAI' });
+ await checkActivityTransaction(driver, {
+ index: 0,
+ amount: '0.001',
+ swapFrom: TEST_ETH,
+ swapTo: DAI,
+ });
+ },
+ );
+ });
+});
From 7d94797c50e8bde272b2f6083981517fdacfd7be Mon Sep 17 00:00:00 2001
From: Xiaoming Wang <7315988+dawnseeker8@users.noreply.github.com>
Date: Tue, 2 Jul 2024 13:59:30 +0100
Subject: [PATCH 10/10] fix: Fix issue 22837 about unknown error during ledger
pair (#25462)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## **Description**
Issue #22837 descrip that ledger sometimes will display `Unknown Error`
during pairing. we have tried to replicate the issue and discover that
it happen during ledger is lock and not open Eth app. this PR will
replace the `Unknown Error` with more meaningful error message to guide
user solve the issue.
[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25462?quickstart=1)
## **Related issues**
Fixes: #22837
## **Manual testing steps**
1. Setup wallet
2. Connect, unlock and open the Ethereum app on Ledger
3. Use the add hardware flow to add some Ledger accounts
4. Remove the Ledger accounts from full screen mode
5. Use add hardware flow to try and add any Ledger accounts
6. Select the `paired` with that ledger when it is available
7. ledger should be locked status or unlock ledger but not opening eth
app.
8. you will see new error message `Unlock your Ledger device and open
the ETH app`
9. After you unlock your ledger and open ETH app. and click paired again
10. you should be able to select accounts from next screen and import
those accounts from ledger.
## **Screenshots/Recordings**
### **Before**
https://recordit.co/kdCDL4laWo
### **After**
https://github.com/MetaMask/metamask-extension/assets/7315988/f11a1867-ad3f-4796-8661-6d3469bed682
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [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.
## **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: chloeYue <105063779+chloeYue@users.noreply.github.com>
---
...r-bridge-keyring-npm-2.0.1-7a5d815b2d.patch | 18 ++++++++++++++++++
package.json | 2 +-
yarn.lock | 17 +++++++++++++++--
3 files changed, 34 insertions(+), 3 deletions(-)
create mode 100644 .yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch
diff --git a/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch b/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch
new file mode 100644
index 000000000000..786d5cd1b226
--- /dev/null
+++ b/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch
@@ -0,0 +1,18 @@
+diff --git a/dist/ledger-keyring.js b/dist/ledger-keyring.js
+index 2386b2e7fe36d1e65ef74f0a19d3b41450dcfa48..f999a0ab465cce7a450a5812f1d7aa6e39b74aed 100644
+--- a/dist/ledger-keyring.js
++++ b/dist/ledger-keyring.js
+@@ -150,7 +150,12 @@ class LedgerKeyring extends events_1.EventEmitter {
+ });
+ }
+ catch (error) {
+- throw error instanceof Error ? error : new Error('Unknown error');
++
++ /**
++ * For Fixing issue 22837, when ledger is locked and didnt open the ethereum app in ledger,
++ * The extension will always show `unknown error`, below change will transform the error to something meaningful.
++ */
++ throw error instanceof Error ? error : new Error('Unlock your Ledger device and open the ETH app');
+ }
+ if (updateHdk && payload.chainCode) {
+ this.hdk.publicKey = buffer_1.Buffer.from(payload.publicKey, 'hex');
diff --git a/package.json b/package.json
index f9dbb8dbeb77..391ffff36e58 100644
--- a/package.json
+++ b/package.json
@@ -298,7 +298,7 @@
"@metamask/ens-controller": "^10.0.1",
"@metamask/eth-json-rpc-filters": "^7.0.0",
"@metamask/eth-json-rpc-middleware": "^12.1.1",
- "@metamask/eth-ledger-bridge-keyring": "^2.0.1",
+ "@metamask/eth-ledger-bridge-keyring": "patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch",
"@metamask/eth-query": "^4.0.0",
"@metamask/eth-sig-util": "^7.0.1",
"@metamask/eth-snap-keyring": "^4.3.1",
diff --git a/yarn.lock b/yarn.lock
index 1b0c258c8e28..87e407e69b99 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5211,7 +5211,7 @@ __metadata:
languageName: node
linkType: hard
-"@metamask/eth-ledger-bridge-keyring@npm:^2.0.1":
+"@metamask/eth-ledger-bridge-keyring@npm:2.0.1":
version: 2.0.1
resolution: "@metamask/eth-ledger-bridge-keyring@npm:2.0.1"
dependencies:
@@ -5224,6 +5224,19 @@ __metadata:
languageName: node
linkType: hard
+"@metamask/eth-ledger-bridge-keyring@patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch":
+ version: 2.0.1
+ resolution: "@metamask/eth-ledger-bridge-keyring@patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch::version=2.0.1&hash=322aa0"
+ dependencies:
+ "@ethereumjs/rlp": "npm:^4.0.0"
+ "@ethereumjs/tx": "npm:^4.1.1"
+ "@ethereumjs/util": "npm:^8.0.0"
+ "@metamask/eth-sig-util": "npm:^7.0.0"
+ hdkey: "npm:^2.1.0"
+ checksum: 10/0f8c86d1b4c323b8a79fa82e3df300034f8dea928569cc3560d1b3352e09e9397844b75b8642ca57866ef5e241b49bd190b8ba7d1b08efa248d9ca909485a674
+ languageName: node
+ linkType: hard
+
"@metamask/eth-query@npm:^3.0.1":
version: 3.0.1
resolution: "@metamask/eth-query@npm:3.0.1"
@@ -25188,7 +25201,7 @@ __metadata:
"@metamask/eslint-plugin-design-tokens": "npm:^1.1.0"
"@metamask/eth-json-rpc-filters": "npm:^7.0.0"
"@metamask/eth-json-rpc-middleware": "npm:^12.1.1"
- "@metamask/eth-ledger-bridge-keyring": "npm:^2.0.1"
+ "@metamask/eth-ledger-bridge-keyring": "patch:@metamask/eth-ledger-bridge-keyring@npm%3A2.0.1#~/.yarn/patches/@metamask-eth-ledger-bridge-keyring-npm-2.0.1-7a5d815b2d.patch"
"@metamask/eth-query": "npm:^4.0.0"
"@metamask/eth-sig-util": "npm:^7.0.1"
"@metamask/eth-snap-keyring": "npm:^4.3.1"