test: fix flaky test Send ETH from inside MetaMask finds the transaction
#24639
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The problem with this flaky test is that in some occurrences we are proceeding to the last Confirmation screen without the balance being loaded (race condition). This can be observed at second 4 from this video. This test fails every time this condition is met (very often in Mutlichain build, possibly due to shorter flow of UI?)
The fix is simply waiting for the balance to be loaded before proceeding with the actions.
However, I think we should also revise the application behaviour, as it does not seem correct that:
I'll open separate tickets for that
Example of failure: https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/81147/workflows/ec5f9950-23fa-4f6f-b248-9f894813e75d/jobs/2874889/tests
e2e-insufficient-balance.mp4
Related issues
Fixes: #24574
Manual testing steps
yarn test:e2e:single test/e2e/tests/transaction/send-eth.spec.js --browser=chrome --leave-running=true --retry-until-failure --retries=15
Screenshots/Recordings
In the test failing artifacts we can see how we cannot proceed with the transaction as the Confirm button is disabled. However the problem is that the gas is set to 0 and never recovered, but the real root cause comes from proceeding with the previous screen without the balance loaded.
Pre-merge author checklist
Pre-merge reviewer checklist