Skip to content

Commit

Permalink
feat: add new method cancelAllTxInQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vorobeyko committed Dec 10, 2024
1 parent 3eb0139 commit cf0c6be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"branches": [
"main",
{
"name": "develop",
"name": "feat/add_cancel_tx",
"channel": "alpha",
"prerelease": "alpha"
}
Expand Down
17 changes: 17 additions & 0 deletions packages/wallets/src/metamask/metamask.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ export class MetamaskPage implements WalletPage {
});
}

async cancelAllTxInQueue() {
await test.step('Force close all transactions', async () => {
await test.step('Close all extension pages', async () => {
const pages = await this.browserContext.pages();
await Promise.all([
pages.map((page) => {
if (page.url().startsWith('chrome-extension://')) page.close();
}),
]);
});
await this.homePage.openWidgetPage();
await this.header.appHeaderLogo.waitFor({ state: 'visible' });
await this.walletOperation.cancelAllTxInQueue(); // reject all tx in queue if exist
await this.page.close();
});
}

async setup() {
await test.step('Setup', async () => {
// added explicit route to #onboarding due to unexpected first time route from /home.html to /onboarding ---> page is close
Expand Down
2 changes: 2 additions & 0 deletions packages/wallets/src/wallet.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface WalletPage {

cancelTx?(page: Page): Promise<void>;

cancelAllTxInQueue?(): Promise<void>;

approveTokenTx?(page: Page): Promise<void>;

openLastTxInEthplorer?(txIndex?: number): Promise<Page>;
Expand Down

0 comments on commit cf0c6be

Please sign in to comment.