-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: [POM] Migrate Snap Account Settings to page object model #27302
test: [POM] Migrate Snap Account Settings to page object model #27302
Conversation
…ement missing methods in HomePage
…ceValidation, and revert login-page.ts
# Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
…s test to use new page objects
… implement missing page objects and methods
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [df51f72]
Page Load Metrics (1861 ± 101 ms)
Bundle size diffs
|
Builds ready [409d6be]
Page Load Metrics (1813 ± 67 ms)
Bundle size diffs
|
this.closeAccountModalButton = 'button[aria-label="Close"]'; | ||
this.closeEditLabelButton = 'button[aria-label="Close"]'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two selectors are the same, I'm thinking if we can find a better selector for both, maybe using a test-id (if it's not too complex to add)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, nice catch, thanks! I found that the close button for modals on the account list is the same, and since we don't have case where multiple modals are open on the account list, I will keep only one selector for the close button on different modals in account list.
@@ -103,16 +111,30 @@ class AccountListPage { | |||
await this.driver.clickElement(this.closeEditLabelButton); | |||
} | |||
|
|||
async closeAccountModal(): Promise<void> { | |||
console.log(`Open add account modal in account list`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the log should say "Close" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch, corrected, thanks !
title: this.test?.fullTitle(), | ||
}, | ||
async ({ driver }: { driver: Driver }) => { | ||
await loginWithBalanceValidation(driver); | ||
await loginWithBalanceValidation(driver, '0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm I think we might want to tweak this function. Instead of having to pass manually the balance, we could use the same approach for the other loginWithBalanceValidation function we have, where we query directly ganache, so there's no need to pass any balance manually.
What do you think?
const logInWithBalanceValidation = async (driver, ganacheServer) => {
await unlockWallet(driver);
// Wait for balance to load
await locateAccountBalanceDOM(driver, ganacheServer);
};
and here the implementation of locate balance using ganache:
const locateAccountBalanceDOM = async (
driver,
ganacheServer,
address = null,
) => {
const balanceSelector = '[data-testid="eth-overview__primary-currency"]';
if (ganacheServer) {
const balance = await ganacheServer.getBalance(address);
await driver.waitForSelector({
css: balanceSelector,
text: `${balance} ETH`,
});
} else {
await driver.findElement(balanceSelector);
}
};
``
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense, i made the changes in this commit: 74f6504
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good @chloeYue Added a couple of suggestions
Quality Gate passedIssues Measures |
Builds ready [74f6504]
Page Load Metrics (1776 ± 81 ms)
Bundle size diffs
|
await loginWithoutBalanceValidation(driver, password); | ||
// Verify the expected balance on the homepage | ||
if (ganacheServer) { | ||
await new HomePage(driver).check_ganacheBalanceIsDisplayed(ganacheServer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Description
This pull request migrate snap account settings test to page object model(POM) pattern, enhancing code maintainability, and improving test reliability.
Also improved the implementation of login methods so we query directly ganache, and there's no need to pass any balance manually.
Description
Related issues
Fixes: #27343
Manual testing steps
Check code readability, make sure tests pass.
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist