-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 onboarding infura call privacy e2e tests (#28079)
## **Description** - Migrate onboarding infura call privacy e2e tests to TypeScript and Page Object Model (POM) pattern. - Improve onboarding related page object modals implementation. - Improve switch network page object modals implementation. - Handle mmi build in `openAccountOptionMenu` method to reduce flakiness - Objective of this PR is to improve test stability and maintainability, it also reduced flakiness. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27155?quickstart=1) ## **Related issues** Fixes: #28080 ## **Manual testing steps** Check code readability, make sure tests pass. ## **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/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. --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Chloe Gao <chloe.gao@consensys.net> Co-authored-by: chloeYue <105063779+chloeYue@users.noreply.github.com> Co-authored-by: Harika <153644847+hjetpoluru@users.noreply.github.com>
- Loading branch information
1 parent
4be7b4a
commit b6639fc
Showing
13 changed files
with
383 additions
and
432 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Driver } from '../../webdriver/driver'; | ||
import HeaderNavbar from '../pages/header-navbar'; | ||
import SelectNetwork from '../pages/dialog/select-network'; | ||
import NetworkSwitchModalConfirmation from '../pages/dialog/network-switch-modal-confirmation'; | ||
|
||
/** | ||
* Switches to a specified network in the header bar. | ||
* | ||
* @param driver | ||
* @param networkName - The name of the network to switch to. | ||
* @param toggleShowTestNetwork - A boolean indicating whether to toggle the display of test networks. Defaults to false. | ||
*/ | ||
export const switchToNetworkFlow = async ( | ||
driver: Driver, | ||
networkName: string, | ||
toggleShowTestNetwork: boolean = false, | ||
) => { | ||
console.log(`Switch to network ${networkName} in header bar`); | ||
const headerNavbar = new HeaderNavbar(driver); | ||
await headerNavbar.check_pageIsLoaded(); | ||
await headerNavbar.clickSwitchNetworkDropDown(); | ||
|
||
const selectNetworkDialog = new SelectNetwork(driver); | ||
await selectNetworkDialog.check_pageIsLoaded(); | ||
if (toggleShowTestNetwork) { | ||
await selectNetworkDialog.toggleShowTestNetwork(); | ||
} | ||
await selectNetworkDialog.selectNetworkName(networkName); | ||
await headerNavbar.check_currentSelectedNetwork(networkName); | ||
}; | ||
|
||
/** | ||
* Search for a network in the select network dialog and switches to it. | ||
* | ||
* @param driver | ||
* @param networkName - The name of the network to search for and switch to. | ||
*/ | ||
export const searchAndSwitchToNetworkFlow = async ( | ||
driver: Driver, | ||
networkName: string, | ||
) => { | ||
console.log( | ||
`Search in select network dialog and switch to network ${networkName}`, | ||
); | ||
const headerNavbar = new HeaderNavbar(driver); | ||
await headerNavbar.check_pageIsLoaded(); | ||
await headerNavbar.clickSwitchNetworkDropDown(); | ||
|
||
const selectNetworkDialog = new SelectNetwork(driver); | ||
await selectNetworkDialog.check_pageIsLoaded(); | ||
await selectNetworkDialog.fillNetworkSearchInput(networkName); | ||
await selectNetworkDialog.clickAddButton(); | ||
|
||
const networkSwitchModalConfirmation = new NetworkSwitchModalConfirmation( | ||
driver, | ||
); | ||
await networkSwitchModalConfirmation.check_pageIsLoaded(); | ||
await networkSwitchModalConfirmation.clickApproveButton(); | ||
await headerNavbar.check_currentSelectedNetwork(networkName); | ||
}; |
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.