From 880eaa570a12c790fe0ae943b16724f10b96b5b0 Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Tue, 23 Jul 2024 15:48:39 +0100 Subject: [PATCH] fix: Remove special reject button case from api spec tests (#26048) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** Merging https://github.com/MetaMask/metamask-extension/pull/25769 toggled on the signatures redesign by default for all tests. This change resulted in `api-spec` tests failing. The fix is removing the logic for conditionally expect a "Reject" button instead of the default "Cancel" for some confirmations. In the redesign all signatures share the same footer. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26048?quickstart=1) ## **Related issues** No issue created for this test failure ## **Manual testing steps** Create a test build, then run `yarn test:api-specs` ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../api-specs/ConfirmationRejectionRule.ts | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/test/e2e/api-specs/ConfirmationRejectionRule.ts b/test/e2e/api-specs/ConfirmationRejectionRule.ts index 9a8348357a69..6271fb63d9ce 100644 --- a/test/e2e/api-specs/ConfirmationRejectionRule.ts +++ b/test/e2e/api-specs/ConfirmationRejectionRule.ts @@ -23,17 +23,12 @@ export class ConfirmationsRejectRule implements Rule { private only: string[]; - private rejectButtonInsteadOfCancel: string[]; - private requiresEthAccountsPermission: string[]; constructor(options: ConfirmationsRejectRuleOptions) { this.driver = options.driver; this.only = options.only; - this.rejectButtonInsteadOfCancel = [ - 'personal_sign', - 'eth_signTypedData_v4', - ]; + this.requiresEthAccountsPermission = [ 'personal_sign', 'eth_signTypedData_v4', @@ -115,19 +110,13 @@ export class ConfirmationsRejectRule implements Rule { await this.driver.waitUntilXWindowHandles(3); await this.driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog); - let text = 'Cancel'; - if (this.rejectButtonInsteadOfCancel.includes(call.methodName)) { - await this.driver.findClickableElements({ - text: 'Reject', - tag: 'button', - }); - text = 'Reject'; - } else { - await this.driver.findClickableElements({ - text: 'Cancel', - tag: 'button', - }); - } + const text = 'Cancel'; + + await this.driver.findClickableElements({ + text: 'Cancel', + tag: 'button', + }); + const screenshot = await this.driver.driver.takeScreenshot(); call.attachments = call.attachments || []; call.attachments.push({