-
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.
feat: Redesigned setApprovalForAll confirmations (#27061)
<!-- 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** Implement setApprovalForAll redesigned confirmation for ERC721 and ERC1155 tokens. Includes e2e tests that use the Page Object Model, and refactors withRedesignedConfirmations to support EIP1559 transactions. <!-- 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? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27061?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#2937 ## **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="472" alt="Screenshot 2024-09-11 at 14 17 54" src="https://github.com/user-attachments/assets/37926775-77df-4f95-a674-9cb91fdaa0ae"> ## **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
d78a181
commit 0a7732b
Showing
36 changed files
with
2,095 additions
and
24 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.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type RawLocator = string | { css: string; text: string }; |
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,27 @@ | ||
import { Driver } from '../../webdriver/driver'; | ||
import { RawLocator } from '../common'; | ||
|
||
class Confirmation { | ||
protected driver: Driver; | ||
|
||
private scrollToBottomButton: RawLocator; | ||
|
||
private footerConfirmButton: RawLocator; | ||
|
||
constructor(driver: Driver) { | ||
this.driver = driver; | ||
|
||
this.scrollToBottomButton = '.confirm-scroll-to-bottom__button'; | ||
this.footerConfirmButton = '[data-testid="confirm-footer-button"]'; | ||
} | ||
|
||
async clickScrollToBottomButton() { | ||
await this.driver.clickElementSafe(this.scrollToBottomButton); | ||
} | ||
|
||
async clickFooterConfirmButton() { | ||
await this.driver.clickElement(this.footerConfirmButton); | ||
} | ||
} | ||
|
||
export default Confirmation; |
35 changes: 35 additions & 0 deletions
35
test/e2e/page-objects/pages/set-approval-for-all-transaction-confirmation.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,35 @@ | ||
import { tEn } from '../../../lib/i18n-helpers'; | ||
import { Driver } from '../../webdriver/driver'; | ||
import { RawLocator } from '../common'; | ||
import TransactionConfirmation from './transaction-confirmation'; | ||
|
||
class SetApprovalForAllTransactionConfirmation extends TransactionConfirmation { | ||
private setApprovalForAllTitleElement: RawLocator; | ||
|
||
private setApprovalForAllSubHeadingElement: RawLocator; | ||
|
||
constructor(driver: Driver) { | ||
super(driver); | ||
|
||
this.driver = driver; | ||
|
||
this.setApprovalForAllTitleElement = { | ||
css: 'h2', | ||
text: tEn('setApprovalForAllRedesignedTitle') as string, | ||
}; | ||
this.setApprovalForAllSubHeadingElement = { | ||
css: 'p', | ||
text: tEn('confirmTitleDescApproveTransaction') as string, | ||
}; | ||
} | ||
|
||
async check_setApprovalForAllTitle() { | ||
await this.driver.waitForSelector(this.setApprovalForAllTitleElement); | ||
} | ||
|
||
async check_setApprovalForAllSubHeading() { | ||
await this.driver.waitForSelector(this.setApprovalForAllSubHeadingElement); | ||
} | ||
} | ||
|
||
export default SetApprovalForAllTransactionConfirmation; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Confirmation from './confirmation'; | ||
|
||
class TransactionConfirmation extends Confirmation {} | ||
|
||
export default TransactionConfirmation; |
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
Oops, something went wrong.