From ae36f8a422c907338220b30bf17d80b0b2a00500 Mon Sep 17 00:00:00 2001 From: Jake <93612860+jake4take@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:25:21 +0400 Subject: [PATCH] feat: the new function for check the WalletAddress (#109) * feat: add getWalletAddress() to Metamask --- packages/wallets/src/metamask/metamask.page.ts | 13 ++++++++++++- packages/wallets/src/wallet.page.ts | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/wallets/src/metamask/metamask.page.ts b/packages/wallets/src/metamask/metamask.page.ts index 4b6854d8..7bc8a28d 100644 --- a/packages/wallets/src/metamask/metamask.page.ts +++ b/packages/wallets/src/metamask/metamask.page.ts @@ -1,7 +1,7 @@ import { WalletConfig } from '../wallets.constants'; import { WalletPage } from '../wallet.page'; import expect from 'expect'; -import { test, BrowserContext, Page } from '@playwright/test'; +import { BrowserContext, Page, test } from '@playwright/test'; export class MetamaskPage implements WalletPage { page: Page | undefined; @@ -279,4 +279,15 @@ export class MetamaskPage implements WalletPage { expect(receiptAddress).toBe(expectedAddress); }); } + async getWalletAddress() { + await this.navigate(); + await this.page.getByTestId('account-options-menu-button').click(); + await this.page.getByTestId('account-list-menu-details').click(); + const address = await this.page + .getByTestId('address-copy-button-text') + .nth(1) + .textContent(); + await this.page.close(); + return address; + } } diff --git a/packages/wallets/src/wallet.page.ts b/packages/wallets/src/wallet.page.ts index 82f4135a..4fb1de30 100644 --- a/packages/wallets/src/wallet.page.ts +++ b/packages/wallets/src/wallet.page.ts @@ -25,6 +25,8 @@ export interface WalletPage { assertReceiptAddress(page: Page, expectedAmount: string): Promise; + getWalletAddress?(): Promise; + addNetwork( networkName: string, networkUrl: string,