Skip to content

Commit 4e2b1d4

Browse files
authored
fix: Fix send max on gas value changes (#30523)
<!-- 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? --> This PR aims to fix send max feature gas issues. It also adds e2e tests that cover: - correct amount - gas modal changes (on picking 'low', 'medium', 'high' - adjusting manual values on gas modal - reacting gas estimation changes in network level [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30523?quickstart=1) ## **Related issues** Fixes: #30269 ## **Manual testing steps** Usual send flow should work properly ## **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 Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.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/main/.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.
1 parent ce289f5 commit 4e2b1d4

File tree

9 files changed

+759
-52
lines changed

9 files changed

+759
-52
lines changed

test/e2e/page-objects/flows/transaction.ts

+16
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ export const createInternalTransaction = async (driver: Driver) => {
1919
await sendToPage.goToNextScreen();
2020
};
2121

22+
export const createInternalTransactionWithMaxAmount = async (
23+
driver: Driver,
24+
) => {
25+
// Firefox has incorrect balance if send flow started too quickly.
26+
await driver.delay(1000);
27+
28+
const homePage = new HomePage(driver);
29+
await homePage.startSendFlow();
30+
31+
const sendToPage = new SendTokenPage(driver);
32+
await sendToPage.check_pageIsLoaded();
33+
await sendToPage.fillRecipient('0x2f318C334780961FB129D2a6c30D0763d9a5C970');
34+
await sendToPage.clickMaxAmountButton();
35+
await sendToPage.goToNextScreen();
36+
};
37+
2238
export const createDappTransaction = async (
2339
driver: Driver,
2440
override?: Partial<TransactionParams>,

test/e2e/page-objects/pages/send/send-token-page.ts

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class SendTokenPage {
4343
private readonly warning =
4444
'[data-testid="send-warning"] .mm-box--min-width-0 span';
4545

46+
private readonly maxAmountButton = '[data-testid="max-clear-button"]';
47+
4648
constructor(driver: Driver) {
4749
this.driver = driver;
4850
}
@@ -138,6 +140,10 @@ class SendTokenPage {
138140
await this.driver.pasteIntoField(this.inputRecipient, recipientAddress);
139141
}
140142

143+
async clickMaxAmountButton(): Promise<void> {
144+
await this.driver.clickElement(this.maxAmountButton);
145+
}
146+
141147
async goToNextScreen(): Promise<void> {
142148
await this.driver.clickElement(this.continueButton);
143149
}

0 commit comments

Comments
 (0)