-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Adds opensea to blockaid migration BannerAlert (#23743)
## **Description** This adds a notice to transaction and signature confirmations for users who have been automatically migrated from the security alerts by Open Sea to security alerts by Blockaid (see #23460) and are on networks that are not supported by Blockaid. The notice can be dismissed and is not shown again once that happens. The PR adds e2e tests to verify the change for simple send, token approval, personal signature, and contract interaction. We intend to remove this notice after a few releases. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/23743?quickstart=1) ## **Related issues** Fixes: [#2134](https://app.zenhub.com/workspaces/-confirmations-secure-ux-6245e6e2348677001213b8d2/issues/gh/metamask/metamask-planning/2134) Related: [#23546](#23546) and #23460 ## **Manual testing steps** 1. Checkout the extension on a commit prior to #23546 (for example, `112b155d59`) 2. Build the app and open metamask 3. Select security alerts by open sea <img width="577" alt="Screenshot 2024-03-27 at 11 01 38" src="https://github.com/MetaMask/metamask-extension/assets/13814744/7f732e93-d772-432a-85b5-87c95ccbdc53"> 4. Checkout this branch, build and reload on the managing extensions page 5. Switch to Linea Goerli, or another network that is not currently supported by blockaid 6. Open the testdApp and trigger a new confirmation 7. The Banner Alert should show up ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **After** #### Simple Send <img width="472" alt="Screenshot 2024-03-26 at 19 04 56" src="https://github.com/MetaMask/metamask-extension/assets/13814744/96466bd3-4d5b-4071-8bad-a7c205bbec6f"> #### Token Approval <img width="472" alt="Screenshot 2024-03-26 at 19 02 11" src="https://github.com/MetaMask/metamask-extension/assets/13814744/2ebc2ff8-2cc7-4479-8379-236dddd447bf"> #### Personal Signature <img width="472" alt="Screenshot 2024-03-26 at 19 00 04" src="https://github.com/MetaMask/metamask-extension/assets/13814744/f6259f01-5c4e-4c81-87ff-98e4db3dec91"> #### Contract Interaction <img width="472" alt="Screenshot 2024-03-26 at 19 07 44" src="https://github.com/MetaMask/metamask-extension/assets/13814744/d81deb5c-c379-4556-a818-2428a4951366"> ## **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 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.
- Loading branch information
1 parent
1eeaf82
commit de76c52
Showing
18 changed files
with
398 additions
and
2 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
135 changes: 135 additions & 0 deletions
135
test/e2e/tests/ppom/migrate-opensea-to-blockaid-banner.spec.js
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,135 @@ | ||
const { connectAccountToTestDapp } = require('../../accounts/common'); | ||
const FixtureBuilder = require('../../fixture-builder'); | ||
const { | ||
defaultGanacheOptions, | ||
unlockWallet, | ||
withFixtures, | ||
openDapp, | ||
WINDOW_TITLES, | ||
} = require('../../helpers'); | ||
|
||
describe('Migrate Opensea to Blockaid Banner @no-mmi', function () { | ||
it('Shows up on simple send transaction', async function () { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixtures: new FixtureBuilder() | ||
.withPreferencesController({ hasMigratedFromOpenSeaToBlockaid: true }) | ||
.build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test.fullTitle(), | ||
}, | ||
async ({ driver }) => { | ||
await driver.navigate(); | ||
await unlockWallet(driver); | ||
await openDapp(driver); | ||
|
||
await connectAccountToTestDapp(driver); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); | ||
await driver.clickElement('#sendButton'); | ||
await driver.delay(2000); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); | ||
await driver.waitForSelector({ text: 'Heads up!', tag: 'p' }); | ||
}, | ||
); | ||
}); | ||
|
||
it('Shows up on token approval', async function () { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixtures: new FixtureBuilder() | ||
.withPreferencesController({ hasMigratedFromOpenSeaToBlockaid: true }) | ||
.build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test.fullTitle(), | ||
}, | ||
async ({ driver }) => { | ||
await driver.navigate(); | ||
await unlockWallet(driver); | ||
await openDapp(driver); | ||
|
||
await connectAccountToTestDapp(driver); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); | ||
await driver.findClickableElement('#createToken'); | ||
await driver.clickElement('#createToken'); | ||
await driver.delay(2000); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); | ||
await driver.findClickableElements({ | ||
text: 'Confirm', | ||
tag: 'button', | ||
}); | ||
await driver.clickElement({ | ||
text: 'Confirm', | ||
tag: 'button', | ||
}); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); | ||
await driver.clickElement({ text: 'Approve Tokens', tag: 'button' }); | ||
await driver.delay(2000); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); | ||
await driver.waitForSelector({ text: 'Heads up!', tag: 'p' }); | ||
}, | ||
); | ||
}); | ||
|
||
it('Shows up on personal signature', async function () { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixtures: new FixtureBuilder() | ||
.withPreferencesController({ hasMigratedFromOpenSeaToBlockaid: true }) | ||
.build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test.fullTitle(), | ||
}, | ||
async ({ driver }) => { | ||
await driver.navigate(); | ||
await unlockWallet(driver); | ||
await openDapp(driver); | ||
|
||
await connectAccountToTestDapp(driver); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); | ||
await driver.clickElement('#personalSign'); | ||
await driver.delay(2000); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); | ||
await driver.waitForSelector({ text: 'Heads up!', tag: 'p' }); | ||
}, | ||
); | ||
}); | ||
|
||
it('Shows up on contract interaction', async function () { | ||
await withFixtures( | ||
{ | ||
dapp: true, | ||
fixtures: new FixtureBuilder() | ||
.withPreferencesController({ hasMigratedFromOpenSeaToBlockaid: true }) | ||
.build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test.fullTitle(), | ||
}, | ||
async ({ driver }) => { | ||
await driver.navigate(); | ||
await unlockWallet(driver); | ||
await openDapp(driver); | ||
|
||
await connectAccountToTestDapp(driver); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); | ||
|
||
await driver.clickElement('#deployMultisigButton'); | ||
await driver.delay(2000); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); | ||
await driver.waitForSelector({ text: 'Heads up!', tag: 'p' }); | ||
}, | ||
); | ||
}); | ||
}); |
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
Oops, something went wrong.