Skip to content

Conversation

seaona
Copy link
Contributor

@seaona seaona commented Sep 4, 2025

Description

This PR adds some improvements in the flaky test Add multiple tokens:

  • instead of manually deploying 3 contracts, one by one, we now pre-deploy them all before the test starts (for that, a new method has been added to the anvil seeder, to get multiple contract addresses)
  • a couple of methods have been improved to mitigate race conditions
  • unnecessary steps have been removed

This will make this spec more robust and fast overall.

Open in GitHub Codespaces

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

  1. Check ci

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

Copy link
Contributor

github-actions bot commented Sep 4, 2025

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.

@metamaskbot metamaskbot added the team-qa QA team label Sep 4, 2025
@github-actions github-actions bot added the size-M label Sep 4, 2025
@metamaskbot
Copy link
Collaborator

metamaskbot commented Sep 4, 2025

✨ Files requiring CODEOWNER review ✨

🧪 @MetaMask/qa (3 files, +29 -15)
  • 📁 test/
    • 📁 e2e/
      • 📁 page-objects/
        • 📁 pages/
          • 📁 dialog/
            • 📄 add-tokens.ts +7 -6
            • 📄 test-dapp.ts +1 -5
      • 📁 seeder/
        • 📄 contract-address-registry.js +21 -4

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: a7df740 | Date: 9/4/2025

📄 https://metamask.github.io/test-dapp/

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.30s (±69ms) 🟡 | historical mean value: 1.32s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 976ms (±67ms) 🟢 | historical mean value: 992ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 89ms (±21ms) 🟢 | historical mean value: 99ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.30s 69ms 1.26s 1.78s 1.34s 1.78s
domContentLoaded 976ms 67ms 940ms 1.45s 1.01s 1.45s
firstPaint 89ms 21ms 72ms 184ms 140ms 184ms
firstContentfulPaint 89ms 21ms 72ms 184ms 140ms 184ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [6b5f6d9]
UI Startup Metrics (1278 ± 71 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1278112414887113261389
load110696112526511501215
domContentLoaded109795512436511431207
domInteractive18145071840
firstPaint69395124944811171192
backgroundConnect2522382789258274
firstReactRender25174662740
getState1454681731
initialActions717411617
loadScripts85372099364904958
setupStore1062331119
WebpackHomeuiStartup20661584278327122462502
load16441252216921017831963
domContentLoaded16341238215021017691938
domInteractive1912224241449
firstPaint1686651474205296
backgroundConnect3817368433565
firstReactRender92383385991294
getState3052896415244
initialActions7217117711
loadScripts16291236213720817651925
setupStore146175171524
FirefoxBrowserifyHomeuiStartup13711167168411614411587
load1193102514399212661345
domContentLoaded1193102514399212651344
domInteractive993223745110215
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect311893123445
firstReactRender27215052936
getState63818612
initialActions41828311
loadScripts1170100714168912401326
setupStore10410512828
WebpackHomeuiStartup15971358203714817031871
load13641135163913014751616
domContentLoaded13641135163913014751616
domInteractive101592694699249
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect30219793643
firstReactRender44366044751
getState73355714
initialActions3156637
loadScripts13411118161813014551595
setupStore11514814920
Benchmark value 1278 exceeds gate value 1234 for chrome browserify home mean uiStartup
Benchmark value 1106 exceeds gate value 1070 for chrome browserify home mean load
Benchmark value 1098 exceeds gate value 1061 for chrome browserify home mean domContentLoaded
Benchmark value 253 exceeds gate value 10 for chrome browserify home mean backgroundConnect
Benchmark value 25 exceeds gate value 23 for chrome browserify home mean firstReactRender
Benchmark value 7 exceeds gate value 1 for chrome browserify home mean initialActions
Benchmark value 854 exceeds gate value 830 for chrome browserify home mean loadScripts
Benchmark value 1389 exceeds gate value 1365 for chrome browserify home p95 uiStartup
Benchmark value 1215 exceeds gate value 1190 for chrome browserify home p95 load
Benchmark value 1207 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded
Benchmark value 1192 exceeds gate value 1180 for chrome browserify home p95 firstPaint
Benchmark value 274 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 17 exceeds gate value 1.2 for chrome browserify home p95 initialActions
Benchmark value 959 exceeds gate value 940 for chrome browserify home p95 loadScripts
Benchmark value 19 exceeds gate value 17 for chrome browserify home p95 setupStore
Benchmark value 30 exceeds gate value 29 for chrome webpack home mean getState
Benchmark value 8 exceeds gate value 7 for chrome webpack home mean initialActions
Benchmark value 2502 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 244 exceeds gate value 195 for chrome webpack home p95 getState
Benchmark value 11 exceeds gate value 7 for chrome webpack home p95 initialActions
Benchmark value 31 exceeds gate value 25 for firefox browserify home mean backgroundConnect
Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender
Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions
Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 215 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 11 exceeds gate value 2 for firefox browserify home p95 initialActions
Benchmark value 28 exceeds gate value 27 for firefox browserify home p95 setupStore
Benchmark value 101 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 31 exceeds gate value 26 for firefox webpack home mean backgroundConnect
Benchmark value 45 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 4 exceeds gate value 1 for firefox webpack home mean initialActions
Benchmark value 249 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 51 exceeds gate value 50 for firefox webpack home p95 firstReactRender
Benchmark value 7 exceeds gate value 2 for firefox webpack home p95 initialActions
Sum of mean exceeds: 422ms | Sum of p95 exceeds: 610.8ms
Sum of all benchmark exceeds: 1032.8ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 43 Bytes (0%)
  • ui: -5.08 KiB (-0.07%)
  • common: 10 Bytes (0%)

@github-actions github-actions bot added size-S and removed size-M labels Sep 5, 2025
await driver.switchToWindowWithTitle(WINDOW_TITLES.Dialog);
const createContractModal = new CreateContractModal(driver);
await createContractModal.checkPageIsLoaded();
await createContractModal.clickConfirm();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can skip the manual deployment of the 3 contracts now

*
* @returns Array of all deployed contract addresses in deployment order
*/
getAllDeployedContractAddresses() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ new method, so we can work with multiple deployed contracts, not just 1 (or 1 by 1)

const createTokenElement = await this.driver.findElement(
this.createTokenButton,
);
await this.driver.scrollToElement(createTokenElement);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the find+scrolling action is unnecessary - our clickElement method handles everything that's needed for that element to be clicked

);

return multipleSuggestedTokens.length === expectedTokenCount;
}, 10000);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes the wallet takes time loading the token entries -- with the previous method there could be race conditions where there we find that element, and has not yet loaded all the tokens.
findElements+assert is a pattern that can lead to race conditions.
Waiting for our expected condition adds robustness to this assertion

@seaona seaona self-assigned this Sep 5, 2025
@seaona seaona marked this pull request as ready for review September 5, 2025 07:17
@seaona seaona requested a review from a team as a code owner September 5, 2025 07:17
@seaona seaona added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Sep 5, 2025
cursor[bot]

This comment was marked as outdated.

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: adbdbdf | Date: 9/5/2025

📄 https://metamask.github.io/test-dapp/

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.29s (±49ms) 🟡 | historical mean value: 1.32s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 968ms (±46ms) 🟢 | historical mean value: 1.00s ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 88ms (±15ms) 🟢 | historical mean value: 100ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.29s 49ms 1.25s 1.72s 1.35s 1.72s
domContentLoaded 968ms 46ms 939ms 1.38s 1.01s 1.38s
firstPaint 88ms 15ms 72ms 152ms 128ms 152ms
firstContentfulPaint 88ms 15ms 72ms 152ms 128ms 152ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [29a002a]
UI Startup Metrics (1228 ± 62 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1228110914056212771325
load106595512135911121160
domContentLoaded105894912085911041153
domInteractive18144661736
firstPaint62771117943410691136
backgroundConnect2462312738249261
firstReactRender23174452438
getState1353551622
initialActions4044558
loadScripts81971393958861911
setupStore961521013
WebpackHomeuiStartup20491509250521121692417
load16561212198015717351870
domContentLoaded16471198197015617291848
domInteractive1812110161451
firstPaint1826545065224299
backgroundConnect3114276273258
firstReactRender90373196284315
getState2842946413247
initialActions52213710
loadScripts16441196196015517261836
setupStore1262441322
FirefoxBrowserifyHomeuiStartup14201215180111414971640
load1232106914547812981365
domContentLoaded1232106914547812981365
domInteractive1033428146113208
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3320109153466
firstReactRender27225862738
getState9312216730
initialActions3044539
loadScripts1206105214327912731339
setupStore94518827
WebpackHomeuiStartup15511339191713316721769
load13251127157011414291505
domContentLoaded13241126156911414281505
domInteractive101313235293256
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect31204363541
firstReactRender43355344651
getState6337469
initialActions411261337
loadScripts13021100155111614101484
setupStore11612316918
Benchmark value 246 exceeds gate value 10 for chrome browserify home mean backgroundConnect
Benchmark value 24 exceeds gate value 23 for chrome browserify home mean firstReactRender
Benchmark value 5 exceeds gate value 1 for chrome browserify home mean initialActions
Benchmark value 261 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 8 exceeds gate value 1.2 for chrome browserify home p95 initialActions
Benchmark value 247 exceeds gate value 195 for chrome webpack home p95 getState
Benchmark value 10 exceeds gate value 7 for chrome webpack home p95 initialActions
Benchmark value 1420 exceeds gate value 1405 for firefox browserify home mean uiStartup
Benchmark value 34 exceeds gate value 25 for firefox browserify home mean backgroundConnect
Benchmark value 27 exceeds gate value 25 for firefox browserify home mean firstReactRender
Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions
Benchmark value 208 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 30 exceeds gate value 24 for firefox browserify home p95 getState
Benchmark value 9 exceeds gate value 2 for firefox browserify home p95 initialActions
Benchmark value 101 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 31 exceeds gate value 26 for firefox webpack home mean backgroundConnect
Benchmark value 44 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 5 exceeds gate value 1 for firefox webpack home mean initialActions
Benchmark value 256 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 51 exceeds gate value 50 for firefox webpack home p95 firstReactRender
Benchmark value 7 exceeds gate value 2 for firefox webpack home p95 initialActions
Sum of mean exceeds: 286ms | Sum of p95 exceeds: 436.8ms
Sum of all benchmark exceeds: 722.8ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 239 Bytes (0.01%)
  • ui: 1.01 KiB (0.01%)
  • common: 1.29 KiB (0.02%)

cursor[bot]

This comment was marked as outdated.

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: b301f4e | Date: 9/5/2025

📄 https://metamask.github.io/test-dapp/

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.32s (±77ms) 🟡 | historical mean value: 1.32s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 1.00s (±74ms) 🟢 | historical mean value: 995ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 88ms (±17ms) 🟢 | historical mean value: 100ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.32s 77ms 1.28s 1.78s 1.39s 1.78s
domContentLoaded 1.00s 74ms 967ms 1.45s 1.05s 1.45s
firstPaint 88ms 17ms 76ms 164ms 132ms 164ms
firstContentfulPaint 88ms 17ms 76ms 164ms 132ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 0e9c95c | Date: 9/5/2025

📄 https://metamask.github.io/test-dapp/

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.30s (±84ms) 🟡 | historical mean value: 1.32s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 980ms (±81ms) 🟢 | historical mean value: 995ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 95ms (±38ms) 🟢 | historical mean value: 100ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.30s 84ms 1.26s 2.01s 1.42s 2.01s
domContentLoaded 980ms 81ms 941ms 1.67s 1.09s 1.67s
firstPaint 95ms 38ms 64ms 256ms 200ms 256ms
firstContentfulPaint 95ms 38ms 64ms 256ms 200ms 256ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [ee65e17]
UI Startup Metrics (1254 ± 71 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1254110414367113031380
load109195612876911401212
domContentLoaded108394812826911311204
domInteractive17144761729
firstPaint74883121243011121189
backgroundConnect2512322759256269
firstReactRender24164762641
getState15591111737
initialActions60607716
loadScripts840682103167889953
setupStore1064051119
WebpackHomeuiStartup20131482272427221862482
load16061194215020417481891
domContentLoaded15971181212520217411877
domInteractive1811158181448
firstPaint1696543567190287
backgroundConnect4016334523472
firstReactRender90373437186323
getState3453177415280
initialActions8229028610
loadScripts15931179211420017391865
setupStore1264251325
FirefoxBrowserifyHomeuiStartup14531211201813614851734
load1252106214978513051394
domContentLoaded1252106114968513051394
domInteractive1033330052108221
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3319109173582
firstReactRender28237263039
getState9317920717
initialActions51498314
loadScripts1226104214627912751367
setupStore1046311944
WebpackHomeuiStartup16491443207114617781964
load13871222170911914981610
domContentLoaded13861221170811914981610
domInteractive105583275897295
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect37237684249
firstReactRender48399975256
getState73233714
initialActions612352348
loadScripts13601201168212014731586
setupStore136149161130
Benchmark value 1255 exceeds gate value 1234 for chrome browserify home mean uiStartup
Benchmark value 1091 exceeds gate value 1070 for chrome browserify home mean load
Benchmark value 1083 exceeds gate value 1061 for chrome browserify home mean domContentLoaded
Benchmark value 251 exceeds gate value 10 for chrome browserify home mean backgroundConnect
Benchmark value 25 exceeds gate value 23 for chrome browserify home mean firstReactRender
Benchmark value 16 exceeds gate value 15 for chrome browserify home mean getState
Benchmark value 6 exceeds gate value 1 for chrome browserify home mean initialActions
Benchmark value 841 exceeds gate value 830 for chrome browserify home mean loadScripts
Benchmark value 1381 exceeds gate value 1365 for chrome browserify home p95 uiStartup
Benchmark value 1212 exceeds gate value 1190 for chrome browserify home p95 load
Benchmark value 1205 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded
Benchmark value 1189 exceeds gate value 1180 for chrome browserify home p95 firstPaint
Benchmark value 270 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 37 exceeds gate value 33 for chrome browserify home p95 getState
Benchmark value 16 exceeds gate value 1.2 for chrome browserify home p95 initialActions
Benchmark value 953 exceeds gate value 940 for chrome browserify home p95 loadScripts
Benchmark value 19 exceeds gate value 17 for chrome browserify home p95 setupStore
Benchmark value 34 exceeds gate value 29 for chrome webpack home mean getState
Benchmark value 8 exceeds gate value 7 for chrome webpack home mean initialActions
Benchmark value 2482 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 280 exceeds gate value 195 for chrome webpack home p95 getState
Benchmark value 10 exceeds gate value 7 for chrome webpack home p95 initialActions
Benchmark value 1454 exceeds gate value 1405 for firefox browserify home mean uiStartup
Benchmark value 1252 exceeds gate value 1245 for firefox browserify home mean load
Benchmark value 1252 exceeds gate value 1239 for firefox browserify home mean domContentLoaded
Benchmark value 34 exceeds gate value 25 for firefox browserify home mean backgroundConnect
Benchmark value 29 exceeds gate value 25 for firefox browserify home mean firstReactRender
Benchmark value 5 exceeds gate value 1 for firefox browserify home mean initialActions
Benchmark value 11 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 1734 exceeds gate value 1660 for firefox browserify home p95 uiStartup
Benchmark value 221 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 82 exceeds gate value 70 for firefox browserify home p95 backgroundConnect
Benchmark value 14 exceeds gate value 2 for firefox browserify home p95 initialActions
Benchmark value 44 exceeds gate value 27 for firefox browserify home p95 setupStore
Benchmark value 1650 exceeds gate value 1615 for firefox webpack home mean uiStartup
Benchmark value 1387 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1387 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 105 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 38 exceeds gate value 26 for firefox webpack home mean backgroundConnect
Benchmark value 49 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 7 exceeds gate value 1 for firefox webpack home mean initialActions
Benchmark value 1964 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 295 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 56 exceeds gate value 50 for firefox webpack home p95 firstReactRender
Benchmark value 8 exceeds gate value 2 for firefox webpack home p95 initialActions
Benchmark value 30 exceeds gate value 28 for firefox webpack home p95 setupStore
Sum of mean exceeds: 501ms | Sum of p95 exceeds: 796.8ms
Sum of all benchmark exceeds: 1297.8ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 239 Bytes (0.01%)
  • ui: 1.73 KiB (0.02%)
  • common: 1.29 KiB (0.02%)

Copy link
Contributor

@chloeYue chloeYue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition, LGTM !

@seaona seaona enabled auto-merge September 5, 2025 10:53
@seaona seaona added this pull request to the merge queue Sep 5, 2025
@DDDDDanica
Copy link
Contributor

LGTM !

Merged via the queue into main with commit d6c4d26 Sep 5, 2025
145 checks passed
@seaona seaona deleted the flaky-test-watch-multiple-assets branch September 5, 2025 14:06
@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2025
@metamaskbot metamaskbot added the release-13.4.0 Issue or pull request that will be included in release 13.4.0 label Sep 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
flaky tests no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-13.4.0 Issue or pull request that will be included in release 13.4.0 size-S team-qa QA team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants