Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fix flaky test `Increase Token Allowance increases token spendi…
…ng cap to allow other accounts to transfer tokens @no-mmi` (#24734) ## **Description** This PR fixes the flaky test `Increase Token Allowance increases token spending cap to allow other accounts to transfer tokens @no-mmi).` The problem with this flaky test is that we are changing the allowance amount (from 0 to 1) and we confirm the transaction before the gas has been updated. This makes that the increase token allowance transaction fails, and the subsequent transaction with the Account 2 cannot be performed as it doesn't have the allowance for doing a transfer from action. So the dialog window cannot be found, as the popup is never triggered (see dapp error). The fix is to simply await for the expected gas for the increaseAllowance with amount 1. This can be clearly seen when you check the tx history from Account 1: - Here is a successful increaseAllowance with amount 1, and the total gas is `31000` -- correct ![Screenshot from 2024-05-23 09-41-59](https://github.com/MetaMask/metamask-extension/assets/54408225/727cc834-de9c-452a-81a6-e8fb40e2f75d) - Here is a failed increaseAllowance with amount 1, and the total gas limit is `26776` -- incorrect (this value corresponds to the increaseAllowance with amount 0) ![Screenshot from 2024-05-23 09-41-53](https://github.com/MetaMask/metamask-extension/assets/54408225/e23fdc1b-0c53-48e5-9368-a17a6bdc7fb4) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/24734?quickstart=1) ## **Related issues** Fixes: one of this cases, but not all of them, as the rest of testcases need to be looked separately #24603 ## **Manual testing steps** 1. Run this test locally multiple times 2. Check ci jobs `yarn test:e2e:single test/e2e/tests/tokens/increase-token-allowance.spec.js --browser=firefox --leave-running --retryUntilFailure --retries=10` ## **Screenshots/Recordings** https://github.com/MetaMask/metamask-extension/assets/54408225/c0d32e57-6ace-4c59-a667-dcafc3421a7c ## **Pre-merge author checklist** - [X] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] 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.
- Loading branch information