fix: switch e2e test to mainnet instead of ganache
Description
Switches e2e test to connect to BSC instead of ganache. This is related to an incoming change on core to remove ganache ID from isTokenListSupportedForNetwork since accountApi does not support ganache and the fetchTokenMetadata would fail not allowing users who are using ganache to see the imported ERC20 tokens.
This e2e test using ganache was passing initially because we mock the following call https://github.com/MetaMask/metamask-extension/blob/5a968da2eeb6818247af982d58e00b14dc7fb72a/test/e2e/mock-e2e.js#L268.
Related issues
Fixes: https://github.com/MetaMask/metamask-mobile/issues/6410 Related to :(https://github.com/MetaMask/core/pull/3777)
Manual testing steps
- Run ganache locally
- Use test dapp to deploy ERC20
- Use test dapp to add the token to wallet (triggering watchAsset)
- You should be able to see the new token in tokens tab
Screenshots/Recordings
Before
After
Pre-merge author checklist
- [ ] I’ve followed MetaMask Coding Standards.
- [ ] I've clearly explained what problem this PR is solving and how it is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using JSDoc format if applicable
- [ ] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
- [ ] I’ve properly set the pull request status:
- [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to "non-draft".
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.
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.
Builds ready [1cce780]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (832 ± 23 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 97 | 133 | 113 | 11 | 5 |
| domContentLoaded | 10 | 53 | 26 | 12 | 6 | ||
| load | 751 | 930 | 832 | 48 | 23 | ||
| domInteractive | 10 | 53 | 26 | 12 | 6 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Generally we don't want E2E tests making external network requests (see these guidelines: https://docs.google.com/document/d/1eQyeScSZQlzGLapef_8PANkU_ObNPJcuMCP040T2gfM/edit). That would include request to Infura, which this would introduce by switching to Mainnet.
Perhaps you could edit the Ganache config to use the chain ID of a supported network instead?
d edit the Ganache config to use the chain ID of a supported network instead?
Hey @Gudahtt , thnx for checking this 🙏 If im not mistaking there is already another e2e test test/e2e/tests/import-tokens.spec.js that is switching to mainnet? Should that also be updated to interact with a supported chainId + mocking the calls to tokenApi ?
Builds ready [e982ada]
- builds: chrome, firefox
- builds (beta): chrome
- builds (flask): chrome, firefox
- builds (MMI): chrome, firefox
- builds (test): chrome, firefox
- builds (test-flask): chrome, firefox
- build viz: Build System
- mv3: Background Module Init Stats
- mv3: UI Init Stats
- mv3: Module Load Stats
- mv3: Bundle Size Stats
- mv2: E2e Actions Stats
- code coverage: Report
- storybook: Storybook
- typescript migration: Dashboard
- all artifacts
Page Load Metrics (941 ± 25 ms)
| Platform | Page | Metric | Min (ms) | Max (ms) | Average (ms) | StandardDeviation (ms) | MarginOfError (ms) |
|---|---|---|---|---|---|---|---|
| Chrome | Home | firstPaint | 109 | 218 | 174 | 27 | 13 |
| domContentLoaded | 9 | 74 | 28 | 25 | 12 | ||
| load | 849 | 1012 | 941 | 52 | 25 | ||
| domInteractive | 9 | 74 | 28 | 25 | 12 |
Bundle size diffs
- background: 0 Bytes (0.00%)
- ui: 0 Bytes (0.00%)
- common: 0 Bytes (0.00%)
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
391e9e7) 68.55% compared to head (e982ada) 68.55%. Report is 5 commits behind head on develop.
Additional details and impacted files
@@ Coverage Diff @@
## develop #22880 +/- ##
========================================
Coverage 68.55% 68.55%
========================================
Files 1088 1088
Lines 42907 42907
Branches 11415 11415
========================================
Hits 29411 29411
Misses 13496 13496
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.