Skip to content

Commit

Permalink
feat: the new function for check the WalletAddress (#109)
Browse files Browse the repository at this point in the history
* feat: add getWalletAddress() to Metamask
  • Loading branch information
jake4take authored Dec 4, 2023
1 parent a02d663 commit ae36f8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/wallets/src/metamask/metamask.page.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
}
}
2 changes: 2 additions & 0 deletions packages/wallets/src/wallet.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export interface WalletPage {

assertReceiptAddress(page: Page, expectedAmount: string): Promise<void>;

getWalletAddress?(): Promise<string>;

addNetwork(
networkName: string,
networkUrl: string,
Expand Down

0 comments on commit ae36f8a

Please sign in to comment.