From 1d33d6f39a499aa6c82c4f97fc288875a55bec30 Mon Sep 17 00:00:00 2001 From: seaona <54408225+seaona@users.noreply.github.com> Date: Thu, 27 Jun 2024 18:48:25 +0200 Subject: [PATCH] fix: flaky test `Swap-Send ETH to non-contract address with data that matches swap data signature submits a transaction successfully` (#25545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** The problem is that we are looking for a pending transaction and then a confirmed transaction. If the transaction is confirmed very fast, the pending transaction is never found, thus making the test fail. This is a bad pattern that introduces flakiness, as we are trying to find an element by its transient state, which is variable. What we really want to assert is that the transaction is in the end confirmed, so we shouldn't try to look for the pending transaction (something that disappears fast) in the first place. Error: ``` TimeoutError: Waiting for element to be located By(css selector, .transaction-status-label--pending) Wait timed out after 10081ms ``` [ci error](https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/89418/workflows/924ea8b8-1698-4dca-ae6e-b724264fe4a2/jobs/3304211/parallel-runs/17?filterBy=ALL) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25545?quickstart=1) ## **Related issues** Fixes: https://github.com/MetaMask/metamask-extension/issues/25546 ## **Manual testing steps** 1. Check ci ## **Screenshots/Recordings** See the screenshot in ci, how the expected transaction is indeed there (confirmed). However, on the error we couldn't locate the element when it was pending (possibly due to being really fast at occasions) ![image](https://github.com/MetaMask/metamask-extension/assets/54408225/6dd42cb2-d71a-4587-b663-49a424493e72) ![Screenshot from 2024-06-27 09-51-55](https://github.com/MetaMask/metamask-extension/assets/54408225/2eab4f8e-bba1-4c23-ab7a-cb141a5a30e9) ## **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. --- test/e2e/tests/swap-send/swap-send-eth.spec.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/e2e/tests/swap-send/swap-send-eth.spec.ts b/test/e2e/tests/swap-send/swap-send-eth.spec.ts index 244693d513a2..e4be22ae1fa3 100644 --- a/test/e2e/tests/swap-send/swap-send-eth.spec.ts +++ b/test/e2e/tests/swap-send/swap-send-eth.spec.ts @@ -74,12 +74,6 @@ describe('Swap-Send ETH', function () { // TODO assert swap api request payload await swapSendPage.submitSwap(); - await swapSendPage.verifyHistoryEntry( - 'Send ETH as TST', - 'Pending', - '-1 ETH', - '', - ); await swapSendPage.verifyHistoryEntry( 'Send ETH as TST', 'Confirmed',