Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: flaky test `Sentry errors after initialization, after opting int…
…o metrics @no-mmi should capture UI application state` (#25137) ## **Description** This PR fixes the flaky test `Sentry errors after initialization, after opting into metrics @no-mmi should capture UI application state`. The logs show how the snapshot assertion does not match with the current state of the wallet. Specifically, the network info is failing: the EIP is empty and the status is unknow, however we expect EIP1559 false and status available. The problem is that we are taking the snapshot whenever we land at the login page and the race condition is when the snapshot is taken before we get the network information from ganache, causing the assertion to fail. The solution here is to make sure that the network is ready and the wallet has it in its state. For that, we perform a loginWithBalance validation. This will make that we login into the wallet and wait until we have balance - which results in having the network info in the wallet state in a deterministic manner now. The snapshot has also been tweaked, to match the new state (logged in). ``` Expected values to be strictly deep-equal: + actual - expected ... Lines skipped { DNS: 'object', ... networksMetadata: { networkConfigurationId: { + EIPS: {}, + status: 'unknown' - EIPS: { - '1559': false - }, - status: 'available' } ... state: 'CLOSED' } } ``` [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/25137?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Check all tests pass in all jobs https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/86270/workflows/970c7910-5e26-4850-a4cf-fbba64d000b6/jobs/3140585 ## **Screenshots/Recordings** ![Screenshot from 2024-06-07 11-49-46](https://github.com/MetaMask/metamask-extension/assets/54408225/56b17425-0123-4ec7-9fc1-df21f7b37b08) ## **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.
- Loading branch information