Repository navigation
feat(e2e): Tron default test-account fixtures [WPN-536] - #43724
ulissesferreira wants to merge 3 commits into
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. |
Builds ready [9987062]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 11 warn · 🔴 0 fail)
Bundle size diffs
|
✨ Files requiring CODEOWNER review ✨🧪 @MetaMask/qa (2 files, +34 -0)
|
d5c95fc to
533c871
Compare
415650b to
34a6a4b
Compare
Builds ready [34a6a4b]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 7 warn · 🔴 1 fail)
Bundle size diffs
|
533c871 to
fb8d80c
Compare
34a6a4b to
fab0832
Compare
fb8d80c to
39457f7
Compare
fab0832 to
168b9f2
Compare
Builds ready [168b9f2]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚀 Bundle size reduced!]
|
39457f7 to
068f7c8
Compare
168b9f2 to
9db0fd9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9db0fd9. Configure here.
| import { TronFixtureAccount } from './with-tron-fixtures'; | ||
| import { GAS_FREE, HTX, SEED, TRX, USDD, USDT } from './tokens'; | ||
|
|
||
| export const TRON_PORTFOLIO_TRX_BALANCE_IN_SUN = 6_072_392; |
There was a problem hiding this comment.
Duplicated portfolio TRX constant
Low Severity
TRON_PORTFOLIO_TRX_BALANCE_IN_SUN is defined again in environments.ts with the same value already exported from test/e2e/seeder/tron/profiles.ts, risking drift if one copy is updated.
Reviewed by Cursor Bugbot for commit 9db0fd9. Configure here.
Builds ready [9db0fd9]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Add withTronFixtures helper, preset account environments, token metadata, and HD account address constants for accounts 1-8. Co-authored-by: Cursor <cursoragent@cursor.com>
Move Tron shared homepage helpers into the fixtures base so Send, account-derivation, and future Tron specs inherit the same page object.
Move the post-node-start callback into the fixtures stack and drop the unused tronState/loadState path now that JSON state loading was removed.
068f7c8 to
d43a3ab
Compare
9db0fd9 to
bb214c9
Compare
|
Builds ready [bb214c9] [reused from 9db0fd9]
⚡ Performance Benchmarks (Total: 🟢 14 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
Closing as superseded by #44160. |
## **Description**
This PR adds the shared plumbing that later local-node PRs build on: a
central `ports.ts` registry and an `afterLocalNodesStart` hook in the
fixtures flow. `testSpecificMock` is intentionally not passed `{
localNodes }` at this stage, keeping the surface minimal for this step.
It is one reviewable step of a linear stack and was extracted from the
earlier MetaMask#43722/MetaMask#43724 work. Validated by running `send-eth.spec.ts` (4/4
passing). Based on a fresh `main` and under 1000 changed lines.
## **Changelog**
CHANGELOG entry: null
## **Related issues**
Part of the local-blockchain E2E initiative (WPN-536).
Extracted from MetaMask#43722/MetaMask#43724; supersedes their fixture-plumbing portion.
## **Manual testing steps**
1. `yarn build:test`
2. `yarn test:e2e:single test/e2e/tests/transaction/send-eth.spec.ts
--browser=chrome` (expect 4/4 passing).
## **Screenshots/Recordings**
N/A — test infrastructure only, no user-facing UI change.
## **Pre-merge author checklist**
- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Test-only infrastructure with a backward-compatible optional hook;
`ports.ts` is unused until later stack PRs.
>
> **Overview**
> Adds **shared E2E infrastructure** for upcoming local-blockchain work:
a new `test/e2e/seeder/ports.ts` module for TCP port validation,
ephemeral allocation (`getAvailablePorts`), single/range availability
checks, and `parsePortRange` string parsing.
>
> Extends **`withFixtures`** in `helpers.js` with an optional
**`afterLocalNodesStart`** callback (default no-op), invoked right after
local nodes are started and before contract seeding—so later tests can
configure nodes without changing the core fixture flow.
**`testSpecificMock`** is unchanged (still not given `{ localNodes }` in
this step).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
076f057. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…4160) ## **Description** This PR adds `withTronFixtures` plus the Tron environment/token helpers and the `non-evm-homepage` page object that later Tron E2E clusters rely on. It is one reviewable step of a linear stack and replaces MetaMask#43724. Validated by its Tron fixtures unit test passing. Based on a fresh `main` and under 1000 changed lines. ## **Changelog** CHANGELOG entry: null ## **Related issues** Part of the local-blockchain E2E initiative (WPN-536). Replaces MetaMask#43724. ## **Manual testing steps** 1. `yarn build:test` 2. Run the Tron fixtures unit test and confirm it passes. 3. Confirm the `non-evm-homepage` page object and Tron environment/token helpers are available to downstream specs. ## **Screenshots/Recordings** N/A — test infrastructure only, no user-facing UI change. ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Test-only changes (fixtures, page objects, constants); no production wallet or auth logic. > > **Overview** > Adds **Tron E2E infrastructure** so later Tron spec clusters can share one setup path instead of ad-hoc mocks and balances. > > **`withTronFixtures`** wraps the existing `withFixtures` flow: it turns declarative account/asset fixtures into local Tron node options, seeds TRC-20 contracts when needed, and registers Mockttp handlers for TronGrid/Infura-style account APIs, MetaMask token/spot-price APIs, feature flags, and optional transaction history. **`buildTronNodeOptions`** is covered by a new unit test in `tron-fixtures.test.ts`. > > Reusable **token definitions** (`TRX`, TRC-10/20 symbols) and **preset accounts** (empty, full portfolio, staked TRX, low TRX + USDT) live under `tests/tron/fixtures/`. **`NonEvmHomepage`** extends the home page object with token balance checks and a Receive click for non-EVM flows. > > **`EXPECTED_TRON_ADDRESSES_BY_INDEX`** in `constants.ts` documents HD accounts 1–8 from the E2E SRP for upcoming account-derivation tests. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit ec06e51. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor <cursoragent@cursor.com>





Summary
Adds
withTronFixtures— a fixture helper that composes localTronNodeseeding, smart-contract deployment, and API mocks from explicit per-account asset declarations.Stack: builds on #43723 (full WPN-536 stack complete after merge)
This PR also introduces
afterLocalNodesStartinwithFixturesso TRC20 contracts can be deployed after the local Tron node is up. JSONloadState/tronStatefile loading was dropped from the stack design.Explainer — default test accounts (Accounts 1–8)
Addresses are derived from
E2E_SRPat BIP44 pathm/44'/195'/0'/0/i(seeEXPECTED_TRON_ADDRESSES_BY_INDEXintest/e2e/constants.ts). Only Account 1 has a canonical default portfolio; Accounts 2–8 have no default on-chain seeding unless a test passes them inwithTronFixtures({ accounts: [...] }).Default holdings table
TJ3QZbBREK1Xybe1jf4nR9Attb8i54vGS3TRON_PORTFOLIO_ACCOUNT/mockTronApis()defaultTQMPuQSHEiUevynTJSCDeh3QSBwJeFKC6WTRQwNiQKov6hQ3pEKVGj2t8ge8YM9vu8ZYTR5uG9oGNSr5hKcCLdN5zF498BTij5Yz1xTHbDj5zszwXFqBuzexjXF71uEU58BVcp3ATBfAcJpbucUvLashnYvQ3uQyeLuD2vAs5JTFcoStNDSQZLadR2MasxMo7E3c19hwvw63TRnntwBfRqh4aXZVaZuLT9Htk1r9JBU4WYNamed environment presets (
fixtures/environments.ts)All presets target Account 1 unless a test overrides
accounts:EMPTY_TRON_ACCOUNTTRON_PORTFOLIO_ACCOUNTTRON_STAKED_PORTFOLIO_ACCOUNTstakedTrxBalance)TRON_LOW_TRX_WITH_USDT_ACCOUNTHow
withTronFixturesworksbuildTronNodeOptions(accounts)→ inlineTronNodestartup balances.afterLocalNodesStart(inwithFixtures) deploys TRC20 contracts when needed (TronSeeder).mockTronFixtureApisregisters mocks whose account/tx responses mirror theaccountsarray, optionally proxied through the live node.Test plan
yarn test:unit test/e2e/helpers/tron-fixtures.test.tswithTronFixtures/environments.tspresetsCHANGELOG entry: null
Made with Cursor