diff --git a/packages/wallets/src/metamask/metamask.page.ts b/packages/wallets/src/metamask/metamask.page.ts index b4858b8b..4d4a8894 100644 --- a/packages/wallets/src/metamask/metamask.page.ts +++ b/packages/wallets/src/metamask/metamask.page.ts @@ -58,7 +58,7 @@ export class MetamaskPage implements WalletPage { await this.loginPage.unlock(); if (await this.header.networkListButton.isVisible()) { await this.popoverElements.closePopover(); - await this.walletOperation.rejectAllTxInQueue(); // reject all tx in queue if exist + await this.walletOperation.cancelAllTxInQueue(); // reject all tx in queue if exist } }); } @@ -70,7 +70,7 @@ export class MetamaskPage implements WalletPage { if (!(await this.header.networkListButton.isVisible())) { await this.onboardingPage.firstTimeSetup(); await this.popoverElements.closePopover(); - await this.walletOperation.rejectAllTxInQueue(); // reject all tx in queue if exist + await this.walletOperation.cancelAllTxInQueue(); // reject all tx in queue if exist await this.settingsPage.setupNetworkChangingSetting(); // need to make it possible to change the wallet network } }); @@ -218,21 +218,9 @@ export class MetamaskPage implements WalletPage { }); } - async signTx(page: Page) { - await test.step('Sign TX', async () => { - await new WalletOperationPage(page).signTransaction(); - }); - } - - async cancelSignTx(page: Page) { - await test.step('Cancel Sign TX', async () => { - await new WalletOperationPage(page).cancelSignTransaction(); - }); - } - - async rejectTx(page: Page) { + async cancelTx(page: Page) { await test.step('Reject TX', async () => { - await new WalletOperationPage(page).rejectTransaction(); + await new WalletOperationPage(page).cancelTransaction(); }); } diff --git a/packages/wallets/src/metamask/pages/walletOperations.page.ts b/packages/wallets/src/metamask/pages/walletOperations.page.ts index dbd60b1c..e37641bb 100644 --- a/packages/wallets/src/metamask/pages/walletOperations.page.ts +++ b/packages/wallets/src/metamask/pages/walletOperations.page.ts @@ -4,13 +4,13 @@ export class WalletOperationPage { page: Page; nextButton: Locator; confirmButton: Locator; - rejectButton: Locator; + approvalCancelButton: Locator; cancelButton: Locator; addTokenButton: Locator; editGasFeeButton: Locator; setHighGasFeeButton: Locator; scrollRequestSignatureBlockButton: Locator; - rejectAllTxsButton: Locator; + cancelAllTxsButton: Locator; confirmRejectAllTxsButton: Locator; recipientButton: Locator; recipientAddress: Locator; @@ -22,7 +22,9 @@ export class WalletOperationPage { this.page = page; this.nextButton = this.page.getByTestId('page-container-footer-next'); this.confirmButton = this.page.getByTestId('confirm-footer-button'); - this.rejectButton = this.page.getByTestId('page-container-footer-cancel'); + this.approvalCancelButton = this.page.getByTestId( + 'page-container-footer-cancel', + ); this.cancelButton = this.page.getByTestId('confirm-footer-cancel-button'); this.addTokenButton = this.page.locator('button:has-text("Add token")'); this.editGasFeeButton = this.page.getByTestId('edit-gas-fee-icon'); @@ -30,9 +32,7 @@ export class WalletOperationPage { this.scrollRequestSignatureBlockButton = this.page.getByTestId( 'signature-request-scroll-button', ); - this.rejectAllTxsButton = this.page.locator( - 'div[class="page-container__footer-secondary"]', - ); + this.cancelAllTxsButton = this.page.getByTestId('confirm-nav__reject-all'); this.confirmRejectAllTxsButton = this.page.locator( 'button:has-text("Reject all")', ); @@ -47,10 +47,10 @@ export class WalletOperationPage { ); } - async rejectAllTxInQueue() { + async cancelAllTxInQueue() { //Is there is any tx in queue. try { - await this.rejectButton.waitFor({ + await this.cancelButton.waitFor({ state: 'visible', timeout: 1000, }); @@ -58,24 +58,19 @@ export class WalletOperationPage { return; } - if (await this.rejectAllTxsButton.isVisible()) { - await this.rejectAllTxsButton.click(); - await this.confirmRejectAllTxsButton.click(); + if (await this.cancelAllTxsButton.isVisible()) { + await this.cancelAllTxsButton.click(); } else { - await this.rejectButton.click(); + await this.cancelButton.click(); } } - async rejectTransaction() { - await this.rejectButton.click(); - } - - async cancelSignTransaction() { - await this.cancelButton.click(); - } - - async signTransaction() { - await this.confirmButton.click(); + async cancelTransaction() { + try { + await this.cancelButton.click(); + } catch { + await this.approvalCancelButton.click(); + } } async confirmTransactionOfTokenApproval() { diff --git a/packages/wallets/src/wallet.page.ts b/packages/wallets/src/wallet.page.ts index 5b2f6519..421d2a2d 100644 --- a/packages/wallets/src/wallet.page.ts +++ b/packages/wallets/src/wallet.page.ts @@ -15,11 +15,7 @@ export interface WalletPage { confirmTx(page: Page, setAggressiveGas?: boolean): Promise; - signTx(page: Page): Promise; - - rejectTx?(page: Page): Promise; - - cancelSignTx?(page: Page): Promise; + cancelTx?(page: Page): Promise; approveTokenTx?(page: Page): Promise;