[e2e] Using ganache requests to getBalance and getAccounts#18215
Merged
[e2e] Using ganache requests to getBalance and getAccounts#18215
Conversation
Contributor
|
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. |
8 tasks
seaona
commented
Mar 17, 2023
| const balanceInt = parseInt(balanceHex, 16) / 10 ** 18; | ||
|
|
||
| const balanceFormatted = | ||
| balanceInt % 1 === 0 ? balanceInt : balanceInt.toFixed(4); |
Member
Author
There was a problem hiding this comment.
If the balance is a float number, we round it up to 4 decimals to match UI.
If it's a whole number, do nothing
seaona
commented
Mar 17, 2023
| driver: driverProxy ?? driver, | ||
| mockServer, | ||
| contractRegistry, | ||
| ganacheServer, |
Member
Author
There was a problem hiding this comment.
we pass ganacheServer to the testsuite to be able to access its methods
seaona
commented
Mar 17, 2023
| await driver.press('#confirm-password', driver.Key.ENTER); | ||
|
|
||
| // balance renders | ||
| const balance = await ganacheServer.getBalance(); |
Member
Author
There was a problem hiding this comment.
here we access the current balance of the acocunt, instead of hardcoding the balance
Collaborator
Builds ready [b2e3f70]
Page Load Metrics (1628 ± 40 ms)
Bundle size diffs
|
jpuri
approved these changes
Mar 17, 2023
Collaborator
Builds ready [775498e]
Page Load Metrics (1718 ± 45 ms)
Bundle size diffs
|
Codecov Report
@@ Coverage Diff @@
## develop #18215 +/- ##
========================================
Coverage 63.96% 63.96%
========================================
Files 914 914
Lines 35623 35623
Branches 9030 9030
========================================
Hits 22784 22784
Misses 12839 12839 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Explanation
Context: sometimes we need to validate tests against the current ETH balance or the account addresst. We used to hardcode this values.
What: with this PR we introduce the Ganache methods for getting the accounts and getting the balance of the account 0, so we do not need to hardcode balances/accounts anymore. Benefits:
setAccountNonceetc.Screenshots/Screencaps
n/a
Before
We look for this specific balance value on the UI:
text: '24.9977 ETH',After
We get the current balance value and look for that value on the UI:
const balance = await ganacheServer.getBalance();text: ${balance} ETH,Manual Testing Steps
Run the affected tests manually on your local:
yarn test:e2e:single test/e2e/tests/send-hex-address.spec.js --browser=chrome --leave-running=trueyarn test:e2e:single test/e2e/tests/metamask-responsive-ui.spec.js --browser=chrome --leave-running=truePre-merge author checklist
Pre-merge reviewer checklist
If further QA is required (e.g. new feature, complex testing steps, large refactor), add the
Extension QA Boardlabel.In this case, a QA Engineer approval will be be required.