Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
chloeYue committed Dec 20, 2024
1 parent b7d2c81 commit ef2016b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 6 additions & 1 deletion test/e2e/flask/create-watch-account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('Account-watcher snap', function (this: Suite) {
},
async ({ driver }: { driver: Driver }) => {
// watch an EOA address
await loginWithBalanceValidation(driver);
await watchEoaAddress(driver, EOA_ADDRESS);

// new account should be displayed in the account list
Expand All @@ -55,6 +56,7 @@ describe('Account-watcher snap', function (this: Suite) {
},
async ({ driver }: { driver: Driver }) => {
// watch an EOA address
await loginWithBalanceValidation(driver);
await watchEoaAddress(driver, EOA_ADDRESS);
const homePage = new HomePage(driver);
await homePage.headerNavbar.check_accountLabel(
Expand Down Expand Up @@ -153,6 +155,7 @@ describe('Account-watcher snap', function (this: Suite) {
},
async ({ driver }: { driver: Driver }) => {
// watch an EOA address for ACCOUNT_2
await loginWithBalanceValidation(driver);
await watchEoaAddress(driver, ACCOUNT_2);
const headerNavbar = new HeaderNavbar(driver);
await headerNavbar.check_accountLabel(DEFAULT_WATCHED_ACCOUNT_NAME);
Expand Down Expand Up @@ -182,6 +185,7 @@ describe('Account-watcher snap', function (this: Suite) {
},
async ({ driver }: { driver: Driver }) => {
// watch an EOA address
await loginWithBalanceValidation(driver);
await watchEoaAddress(driver, EOA_ADDRESS);

// open account details modal in header navbar
Expand Down Expand Up @@ -210,6 +214,7 @@ describe('Account-watcher snap', function (this: Suite) {
},
async ({ driver }: { driver: Driver }) => {
// watch an EOA address
await loginWithBalanceValidation(driver);
await watchEoaAddress(driver, EOA_ADDRESS);
const homePage = new HomePage(driver);
await homePage.headerNavbar.check_accountLabel(
Expand All @@ -233,7 +238,7 @@ describe('Account-watcher snap', function (this: Suite) {
await homePage.check_expectedBalanceIsDisplayed();

// watch the same EOA address again and check the account is recreated
await watchEoaAddress(driver, EOA_ADDRESS, false);
await watchEoaAddress(driver, EOA_ADDRESS);
await homePage.headerNavbar.check_accountLabel(
DEFAULT_WATCHED_ACCOUNT_NAME,
);
Expand Down
6 changes: 0 additions & 6 deletions test/e2e/page-objects/flows/watch-account.flow.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
import { Driver } from '../../webdriver/driver';
import HomePage from '../pages/home/homepage';
import AccountListPage from '../pages/account-list-page';
import { loginWithBalanceValidation } from './login.flow';

/**
* Initiates the flow of watching an EOA address.
*
* @param driver - The WebDriver instance.
* @param address - The EOA address that is to be watched.
* @param unlockWalletFirst - A boolean indicating whether the wallet should be unlocked before attempting to watch the address. Default is true.
*/
export async function watchEoaAddress(
driver: Driver,
address: string,
unlockWalletFirst: boolean = true,
): Promise<void> {
if (unlockWalletFirst) {
await loginWithBalanceValidation(driver);
}
// watch a new EOA
const homePage = new HomePage(driver);
await homePage.headerNavbar.openAccountMenu();
Expand Down

0 comments on commit ef2016b

Please sign in to comment.