-
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.
test: [POM] Migrate token tests (#29375)
<!-- 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** * Updates `asset-list` Page Object - Adds methods for interacting with token list (i.e sorting, getting list, assertion on increase/decrease price and percentage) * Adds new method for importing a custom token using contract address * Adds new method for adding multiple tokens by search in one step * Minor update to `send-token` page for warning message * New page object for `token-overview` * Tests Updated - `import-tokens`, `send-erc20-to-contract`, `token-list` and `token-sort` ## **Related issues** Fixes: ## **Manual testing steps** * All tests must pass on CI ## **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** - [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: Chloe Gao <[email protected]> Co-authored-by: chloeYue <[email protected]> Co-authored-by: MetaMask Bot <[email protected]>
- Loading branch information
1 parent
e5ff471
commit 7fe00dc
Showing
8 changed files
with
447 additions
and
300 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Driver } from '../../webdriver/driver'; | ||
|
||
class TokenOverviewPage { | ||
private driver: Driver; | ||
|
||
private readonly receiveButton = { | ||
text: 'Receive', | ||
css: '.icon-button', | ||
}; | ||
|
||
private readonly sendButton = { | ||
text: 'Send', | ||
css: '.icon-button', | ||
}; | ||
|
||
private readonly swapButton = { | ||
text: 'Swap', | ||
css: '.icon-button', | ||
}; | ||
|
||
constructor(driver: Driver) { | ||
this.driver = driver; | ||
} | ||
|
||
async check_pageIsLoaded(): Promise<void> { | ||
try { | ||
await this.driver.waitForMultipleSelectors([ | ||
this.sendButton, | ||
this.swapButton, | ||
]); | ||
} catch (e) { | ||
console.log( | ||
'Timeout while waiting for Token overview page to be loaded', | ||
e, | ||
); | ||
throw e; | ||
} | ||
console.log('Token overview page is loaded'); | ||
} | ||
|
||
async clickReceive(): Promise<void> { | ||
await this.driver.clickElement(this.receiveButton); | ||
} | ||
|
||
async clickSend(): Promise<void> { | ||
await this.driver.clickElement(this.sendButton); | ||
} | ||
|
||
async clickSwap(): Promise<void> { | ||
await this.driver.clickElement(this.swapButton); | ||
} | ||
} | ||
|
||
export default TokenOverviewPage; |
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.