-
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 Account Custom Name to page object model (#27283)
## **Description** This pull request migrate account custom name interactions to page object model(POM) pattern, enhancing code maintainability, and improving test reliability. It also includes migration for the test file `test/e2e/tests/account/account-custom-name.spec.ts` as example [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27155?quickstart=1) ## **Related issues** Fixes: #27163 ## **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 <[email protected]> Co-authored-by: chloeYue <[email protected]> Co-authored-by: seaona <[email protected]>
- Loading branch information
1 parent
b2cb568
commit 4b4d8d5
Showing
7 changed files
with
183 additions
and
115 deletions.
There are no files selected for viewing
This file was deleted.
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,61 @@ | ||
import { Suite } from 'mocha'; | ||
import { Driver } from '../../webdriver/driver'; | ||
import { defaultGanacheOptions, withFixtures } from '../../helpers'; | ||
import FixtureBuilder from '../../fixture-builder'; | ||
import { loginWithBalanceValidation } from '../../page-objects/flows/login.flow'; | ||
import AccountListPage from '../../page-objects/pages/account-list-page'; | ||
import HeaderNavbar from '../../page-objects/pages/header-navbar'; | ||
|
||
const newAccountLabel = 'Custom name'; | ||
const anotherAccountLabel = '2nd custom name'; | ||
|
||
describe('Account Custom Name Persistence', function (this: Suite) { | ||
it('persists custom account label through account change and wallet lock', async function () { | ||
await withFixtures( | ||
{ | ||
fixtures: new FixtureBuilder().build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test?.fullTitle(), | ||
}, | ||
async ({ driver }: { driver: Driver }) => { | ||
await loginWithBalanceValidation(driver); | ||
|
||
const headerNavbar = new HeaderNavbar(driver); | ||
await headerNavbar.openAccountMenu(); | ||
|
||
// Change account label for existing account and verify edited account label | ||
const accountListPage = new AccountListPage(driver); | ||
await accountListPage.check_pageIsLoaded(); | ||
await accountListPage.openAccountOptionsMenu(); | ||
await accountListPage.changeAccountLabel(newAccountLabel); | ||
await headerNavbar.check_accountLabel(newAccountLabel); | ||
|
||
// Add new account with custom label and verify new added account label | ||
await headerNavbar.openAccountMenu(); | ||
await accountListPage.check_pageIsLoaded(); | ||
await accountListPage.addNewAccountWithCustomLabel(anotherAccountLabel); | ||
await headerNavbar.check_accountLabel(anotherAccountLabel); | ||
|
||
// Switch back to the first account and verify first custom account persists | ||
await headerNavbar.openAccountMenu(); | ||
await accountListPage.check_pageIsLoaded(); | ||
await accountListPage.check_accountDisplayedInAccountList( | ||
newAccountLabel, | ||
); | ||
await accountListPage.switchToAccount(newAccountLabel); | ||
|
||
// Lock and unlock wallet | ||
await headerNavbar.lockMetaMask(); | ||
await loginWithBalanceValidation(driver); | ||
|
||
// Verify both account labels persist after unlock | ||
await headerNavbar.check_accountLabel(newAccountLabel); | ||
await headerNavbar.openAccountMenu(); | ||
await accountListPage.check_pageIsLoaded(); | ||
await accountListPage.check_accountDisplayedInAccountList( | ||
anotherAccountLabel, | ||
); | ||
}, | ||
); | ||
}); | ||
}); |
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.