-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> Implements redesigned native asset transfer (Simple send) both for wallet initiated and dApp initiated confirmations. Includes e2e tests. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27979?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#3028 MetaMask/MetaMask-planning#3027 ## **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] --> <img width="358" alt="Screenshot 2024-10-21 at 10 32 05" src="https://github.com/user-attachments/assets/a8149e22-0f5a-49e5-b051-cc3969db9d1a"> ## **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.
- Loading branch information
1 parent
7e765c3
commit 5bb3885
Showing
18 changed files
with
970 additions
and
80 deletions.
There are no files selected for viewing
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
113 changes: 113 additions & 0 deletions
113
test/e2e/tests/confirmations/transactions/native-send-redesign.spec.ts
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,113 @@ | ||
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */ | ||
import { TransactionEnvelopeType } from '@metamask/transaction-controller'; | ||
import { DAPP_URL } from '../../../constants'; | ||
import { | ||
unlockWallet, | ||
veryLargeDelayMs, | ||
WINDOW_TITLES, | ||
} from '../../../helpers'; | ||
import TokenTransferTransactionConfirmation from '../../../page-objects/pages/confirmations/redesign/token-transfer-confirmation'; | ||
import HomePage from '../../../page-objects/pages/homepage'; | ||
import SendTokenPage from '../../../page-objects/pages/send/send-token-page'; | ||
import TestDapp from '../../../page-objects/pages/test-dapp'; | ||
import { Driver } from '../../../webdriver/driver'; | ||
import { withRedesignConfirmationFixtures } from '../helpers'; | ||
import { TestSuiteArguments } from './shared'; | ||
|
||
const TOKEN_RECIPIENT_ADDRESS = '0x2f318C334780961FB129D2a6c30D0763d9a5C970'; | ||
|
||
describe('Confirmation Redesign Native Send @no-mmi', function () { | ||
describe('Wallet initiated', async function () { | ||
it('Sends a type 0 transaction (Legacy)', async function () { | ||
await withRedesignConfirmationFixtures( | ||
this.test?.fullTitle(), | ||
TransactionEnvelopeType.legacy, | ||
async ({ driver }: TestSuiteArguments) => { | ||
await createWalletInitiatedTransactionAndAssertDetails(driver); | ||
}, | ||
); | ||
}); | ||
|
||
it('Sends a type 2 transaction (EIP1559)', async function () { | ||
await withRedesignConfirmationFixtures( | ||
this.test?.fullTitle(), | ||
TransactionEnvelopeType.feeMarket, | ||
async ({ driver }: TestSuiteArguments) => { | ||
await createWalletInitiatedTransactionAndAssertDetails(driver); | ||
}, | ||
); | ||
}); | ||
}); | ||
|
||
describe('dApp initiated', async function () { | ||
it('Sends a type 0 transaction (Legacy)', async function () { | ||
await withRedesignConfirmationFixtures( | ||
this.test?.fullTitle(), | ||
TransactionEnvelopeType.legacy, | ||
async ({ driver }: TestSuiteArguments) => { | ||
await createDAppInitiatedTransactionAndAssertDetails(driver); | ||
}, | ||
); | ||
}); | ||
|
||
it('Sends a type 2 transaction (EIP1559)', async function () { | ||
await withRedesignConfirmationFixtures( | ||
this.test?.fullTitle(), | ||
TransactionEnvelopeType.feeMarket, | ||
async ({ driver }: TestSuiteArguments) => { | ||
await createDAppInitiatedTransactionAndAssertDetails(driver); | ||
}, | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
async function createWalletInitiatedTransactionAndAssertDetails( | ||
driver: Driver, | ||
) { | ||
await unlockWallet(driver); | ||
|
||
const testDapp = new TestDapp(driver); | ||
|
||
await testDapp.openTestDappPage({ contractAddress: null, url: DAPP_URL }); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.ExtensionInFullScreenView); | ||
const homePage = new HomePage(driver); | ||
await homePage.startSendFlow(); | ||
const sendToPage = new SendTokenPage(driver); | ||
await sendToPage.check_pageIsLoaded(); | ||
await sendToPage.fillRecipient(TOKEN_RECIPIENT_ADDRESS); | ||
await sendToPage.fillAmount('1'); | ||
await sendToPage.goToNextScreen(); | ||
|
||
const tokenTransferTransactionConfirmation = | ||
new TokenTransferTransactionConfirmation(driver); | ||
await tokenTransferTransactionConfirmation.check_walletInitiatedHeadingTitle(); | ||
await tokenTransferTransactionConfirmation.check_networkParagraph(); | ||
await tokenTransferTransactionConfirmation.check_networkFeeParagraph(); | ||
|
||
await tokenTransferTransactionConfirmation.clickFooterConfirmButton(); | ||
} | ||
|
||
async function createDAppInitiatedTransactionAndAssertDetails(driver: Driver) { | ||
await unlockWallet(driver); | ||
|
||
const testDapp = new TestDapp(driver); | ||
|
||
await testDapp.openTestDappPage({ contractAddress: null, url: DAPP_URL }); | ||
|
||
await driver.switchToWindowWithTitle(WINDOW_TITLES.TestDApp); | ||
|
||
await testDapp.clickSimpleSendButton(); | ||
|
||
await driver.delay(veryLargeDelayMs); | ||
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); | ||
const tokenTransferTransactionConfirmation = | ||
new TokenTransferTransactionConfirmation(driver); | ||
await tokenTransferTransactionConfirmation.check_dappInitiatedHeadingTitle(); | ||
await tokenTransferTransactionConfirmation.check_networkParagraph(); | ||
await tokenTransferTransactionConfirmation.check_networkFeeParagraph(); | ||
|
||
await tokenTransferTransactionConfirmation.clickScrollToBottomButton(); | ||
await tokenTransferTransactionConfirmation.clickFooterConfirmButton(); | ||
} |
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.