-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add wallet state injection and yarn start:with-state
script
#26222
Conversation
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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #26222 +/- ##
===========================================
- Coverage 70.02% 69.90% -0.12%
===========================================
Files 1443 1450 +7
Lines 50162 50249 +87
Branches 14039 14046 +7
===========================================
Hits 35124 35124
- Misses 15038 15125 +87 ☔ View full report in Codecov by Sentry. |
Builds ready [dabdb0f]
Page Load Metrics (231 ± 230 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [3ffe5c6]
Page Load Metrics (155 ± 182 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [14c8f4c]
Page Load Metrics (89 ± 9 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
test/e2e/fixture-builder.js
Outdated
const { toHex } = require('@metamask/controller-utils'); | ||
const { NetworkStatus } = require('@metamask/network-controller'); | ||
|
||
const { CHAIN_IDS, NETWORK_TYPES } = require('../../shared/constants/network'); | ||
const { SMART_CONTRACTS } = require('./seeder/smart-contracts'); | ||
const { DAPP_URL, DAPP_ONE_URL, ACCOUNT_1 } = require('./helpers'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of using the variables from the helpers file, we now use them from the constants file.
This change was needed in this PR since otherwise we get an error because the test environment variables in the helpers file are not defined (which is expected as we don't run any test environment with the wallet state functionality, but we do need the fixture-builder methods)
@@ -145,7 +145,7 @@ env: | |||
# The unlock password | |||
- PASSWORD: null | |||
- TEST_SRP: null | |||
- SKIP_ONBOARDING: null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we changed this to a more generic name, as the feature is expanded to handle more wallet state data, than just skipping the onboarding
firstTimeState = { ...firstTimeState, ...skipOnboardingStateOverrides }; | ||
if (process.env.WITH_STATE) { | ||
const stateOverrides = await generateWalletState(); | ||
firstTimeState = { ...firstTimeState, ...stateOverrides }; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we changed this variable names, as the skip onboarding feature is expanded to handle more wallet state data, than just skipping the onboarding
Builds ready [e793540]
Page Load Metrics (74 ± 9 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [3e9ddff]
Page Load Metrics (75 ± 8 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [dd598ba]
Page Load Metrics (67 ± 7 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Hi @seaona , i tested on your branch, i encountered a issue that the ERC20 tokens are not displayed, not sure what's the problem, could you have a look? Thanks ! Screen.Recording.2024-09-06.at.14.25.50.mov |
whoaa nice catch 😍 thank you @chloeYue ! the logic for substituting the account address was not correct, so it was appearing only in mine since the address was hardcoded. Now it should be fixed |
Builds ready [27c2962]
Page Load Metrics (1739 ± 65 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA test OK! LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!! Thanks @seaona this helps a lot for testing.
db85677
18c5c39
to
46bd784
Compare
Quality Gate failedFailed conditions |
Builds ready [46bd784]
Page Load Metrics (1742 ± 86 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Test OK on the latest branch status ! |
Missing release label release-12.5.0 on PR. Adding release label release-12.5.0 on PR and removing other release labels(release-12.6.0), as PR was added to branch 12.5.0 when release was cut. |
Description
With this PR, we add a new script that you can use to build the wallet in dev mode with a preloaded state.
Default Fixtures:
yarn start:with-state
- should load a wallet with the SRP and password set in the metamaskrc file, with several controllers data (contacts, transactions, notifications...) defined in the fixtures-flags file.Terminal Help:
yarn start:with-state --help
to see the available fixture flags to customizeCustom Fixtures:
yarn start:with-state --withAccounts=12 --withContacts=13
with-state-final.mp4
Future Work:
This sets the base for adding and customizing more wallet state. We can expand this as much as we want. Here are the listed possible future tasks:
Related issues
Fixes:
Manual testing steps
Check main functionality:
PASSWORD
and aTEST_SRP
to your metamaskrc fileyarn start:with-state
===============================
Check flags validation:
yarn start:with-state --help
===============================
Check custom fixtures:
yarn start:with-state --withErc20Tokens=false --withXYZ=123 ...
Screenshots/Recordings
Above
Pre-merge author checklist
Pre-merge reviewer checklist