metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

fix: flaky test `Multichain API Connect wallet to the multichain dapp via `externally_connectable`, call `wallet_createSession` with requested EVM scope that does NOT match one of the users enabled networks the specified EVM scopes that do not match the user's configured networks should be treated as if they were not requested`

Open seaona opened this issue 1 month ago • 5 comments

Description

The race condition happens because whenever we want to get the results, we take the first result of the items list, which is the last one. However, it can happen that the latest result is not yet loaded, taking the previous result thus making the assert fail.

Now we wait until the expected items are in the results list, then we read the result.

image image

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.

[!NOTE] Stabilizes multichain E2E session tests by waiting for expected result items before parsing and adding account verification helpers, updating specs accordingly.

  • E2E utilities:
    • TestDappMultichain.getSession now accepts numberOfResultItems and waits for the full results list before parsing to avoid race conditions; added checkResultListTotalItems, checkConnectedAccounts, and related selectors.
    • ConnectAccountConfirmation adds checkForAccountsInPermissionList and simplifies Solana account creation clicks.
  • Tests updated:
    • wallet_createSession.spec.ts, wallet_getSession.spec.ts, wallet_revokeSession.spec.ts use the new getSession({ numberOfResultItems }) and account checks; add assertions for connected accounts and permission list; minor refactors to increase reliability.

Written by Cursor Bugbot for commit aadfc3b946e9258233f5468350a60d1eb3e7d721. This will update automatically on new commits. Configure here.

seaona avatar Dec 10 '25 08:12 seaona

✨ Files requiring CODEOWNER review ✨

🧪 @MetaMask/qa (2 files, +47 -13)
  • 📁 test/
    • 📁 e2e/
      • 📁 page-objects/
        • 📁 pages/
          • 📁 confirmations/
            • 📁 redesign/
              • 📄 connect-account-confirmation.ts +15 -12
            • 📄 test-dapp-multichain.ts +32 -1

👨‍🔧 @MetaMask/wallet-integrations (3 files, +37 -5)
  • 📁 test/
    • 📁 e2e/
      • 📁 flask/
        • 📁 multichain-api/
          • 📁 evm/
            • 📄 wallet_createSession.spec.ts +28 -2
            • 📄 wallet_getSession.spec.ts +6 -2
            • 📄 wallet_revokeSession.spec.ts +3 -1

metamaskbot avatar Dec 10 '25 08:12 metamaskbot

Builds ready [67d830e]
UI Startup Metrics (1334 ± 107 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13341081172410714011508
load108290014719611371241
domContentLoaded107589214649511311233
domInteractive2717100192587
firstPaint50684149341710591174
backgroundConnect22620326113236256
firstReactRender5334143196080
getState45161632550106
initialActions107113
loadScripts8576831217919091012
setupStore1372941621
numNetworkReqs1367418668
BrowserifyPower User HomeuiStartup19071559256915819932173
load1087892144212811751293
domContentLoaded1077885143412811661279
domInteractive3017106212791
firstPaint54410013574199931276
backgroundConnect25320362095239568
firstReactRender47376554957
getState19814771376204244
initialActions103112
loadScripts86368311961279541075
setupStore1574971534
numNetworkReqs72561372070130
WebpackStandard HomeuiStartup829694112479872972
load67358189674724811
domContentLoaded66757688474717806
domInteractive2716105192383
firstPaint270104889198267717
backgroundConnect12678101229
firstReactRender54342133250130
getState271459113547
initialActions103112
loadScripts66457487473715803
setupStore1162941220
numNetworkReqs1468120674
WebpackPower User HomeuiStartup14631109228521416331830
load7486021123105864917
domContentLoaded7405941117104852909
domInteractive34172413527118
firstPaint31398894223371861
backgroundConnect1008678182101612
firstReactRender52427675567
getState19814182794198265
initialActions102012
loadScripts7375921109103850906
setupStore1463871435
numNetworkReqs72581502168135
FirefoxBrowserifyStandard HomeuiStartup13421073224220414321789
load105889713659811261239
domContentLoaded105789313659811261239
domInteractive60321843485136
firstPaint------
backgroundConnect56223074863167
firstReactRender39307994260
getState156114191153
initialActions102022
loadScripts103188112578710931206
setupStore225825831141
numNetworkReqs1569021876
BrowserifyPower User HomeuiStartup26271687384556230903438
load16421002275450421362377
domContentLoaded16421002275350421322377
domInteractive175321125271131969
firstPaint------
backgroundConnect209251108244225995
firstReactRender5435105125978
getState1437796192164209
initialActions40669230
loadScripts1523971256546320172325
setupStore3152464136105
numNetworkReqs76581302284127
WebpackStandard HomeuiStartup16511341319728416782238
load13521126289623513621600
domContentLoaded13511126289523513621600
domInteractive8528148314488134
firstPaint------
backgroundConnect68182424988170
firstReactRender4534119114857
getState187142221566
initialActions103122
loadScripts13181111279122513321512
setupStore2262253615101
numNetworkReqs1568521975
WebpackPower User HomeuiStartup27451826390254031743516
load19031141264150423682559
domContentLoaded19031141264150423682559
domInteractive233291019330301975
firstPaint------
backgroundConnect167251089217199929
firstReactRender5835137146375
getState1337725047157238
initialActions3039527
loadScripts18111124262348322842495
setupStore3753535947189
numNetworkReqs76571312276128
📊 Page Load Benchmark Results

Current Commit: 67d830e | Date: 12/10/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±40ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 715ms (±37ms) 🟢 | historical mean value: 722ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 75ms (±12ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 40ms 1.00s 1.32s 1.05s 1.32s
domContentLoaded 715ms 37ms 695ms 987ms 742ms 987ms
firstPaint 75ms 12ms 60ms 176ms 84ms 176ms
firstContentfulPaint 75ms 12ms 60ms 176ms 84ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 161 Bytes (0%)
  • common: 20 Bytes (0%)

metamaskbot avatar Dec 10 '25 11:12 metamaskbot

Builds ready [dad0855]
UI Startup Metrics (1215 ± 117 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1215977158811712831406
load100082912978910581146
domContentLoaded99382212778710501135
domInteractive241586172075
firstPaint628142130740010121141
backgroundConnect19818023912206222
firstReactRender413087114469
getState3617153194066
initialActions102111
loadScripts804642107783851949
setupStore1152741222
numNetworkReqs1468120674
BrowserifyPower User HomeuiStartup17931441216016919222071
load980822128611510661186
domContentLoaded971815127611410591176
domInteractive261688172379
firstPaint6159512964069901186
backgroundConnect20118056940204221
firstReactRender46377974766
getState20115067194202281
initialActions103112
loadScripts7856371087111864986
setupStore1594381334
numNetworkReqs72581592071131
WebpackStandard HomeuiStartup776638109987836933
load62254582376668781
domContentLoaded61653981775661776
domInteractive2514109202081
firstPaint27394820193245745
backgroundConnect126120121329
firstReactRender4830162225093
getState291498143749
initialActions104112
loadScripts61353681574659773
setupStore1062841219
numNetworkReqs1467920673
WebpackPower User HomeuiStartup14741152203620316281883
load7616121186113861945
domContentLoaded7536061172112854938
domInteractive33171342628107
firstPaint3051031063239290871
backgroundConnect63864214228565
firstReactRender51426955263
getState213143797101215327
initialActions102011
loadScripts7506041162111849933
setupStore1684281437
numNetworkReqs72561582268137
FirefoxBrowserifyStandard HomeuiStartup13611094212520014531780
load1084931145610711411302
domContentLoaded1084931145610711411301
domInteractive69282314390141
firstPaint------
backgroundConnect54222724963197
firstReactRender38317073958
getState13787111132
initialActions102022
loadScripts105691613149511201244
setupStore256823861148
numNetworkReqs1568521875
BrowserifyPower User HomeuiStartup26811655371254031143320
load1660981271850421482370
domContentLoaded1660980271850421482369
domInteractive190331184294157981
firstPaint------
backgroundConnect204281166250228976
firstReactRender5739125136286
getState150741127109170242
initialActions4146738
loadScripts1570963251946720382271
setupStore3443505238111
numNetworkReqs76591402369130
WebpackStandard HomeuiStartup15701324207516416631913
load12931106163611013531524
domContentLoaded12921106163511013521524
domInteractive71292323788133
firstPaint------
backgroundConnect56181833566137
firstReactRender4333103124473
getState177227261354
initialActions103112
loadScripts12621093160410313151499
setupStore165166191349
numNetworkReqs1568421878
WebpackPower User HomeuiStartup28651818381053932873588
load19671171290752224012735
domContentLoaded19661170290752224012734
domInteractive181321042282145992
firstPaint------
backgroundConnect2033112652662141028
firstReactRender5939122126478
getState1357327244153235
initialActions4157827
loadScripts18341151277849922802704
setupStore4463697038232
numNetworkReqs75521402468126
📊 Page Load Benchmark Results

Current Commit: dad0855 | Date: 12/10/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±38ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 731ms (±36ms) 🟢 | historical mean value: 721ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 78ms (±13ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 38ms 1.02s 1.33s 1.08s 1.33s
domContentLoaded 731ms 36ms 704ms 999ms 751ms 999ms
firstPaint 78ms 13ms 60ms 196ms 84ms 196ms
firstContentfulPaint 78ms 13ms 60ms 196ms 84ms 196ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 58 Bytes (0%)
  • ui: -2.39 KiB (-0.03%)
  • common: -737 Bytes (-0.01%)

metamaskbot avatar Dec 10 '25 12:12 metamaskbot

Builds ready [58ee57a]
UI Startup Metrics (1259 ± 108 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12591038150510813391458
load103185912918510901171
domContentLoaded102485512828510811165
domInteractive251599182173
firstPaint4798511833749361113
backgroundConnect21219926412215240
firstReactRender4531100135173
getState341770114157
initialActions107112
loadScripts819653107181873951
setupStore1272941321
numNetworkReqs1367720674
BrowserifyPower User HomeuiStartup19071537248715619732162
load1074889166112311501261
domContentLoaded1063882162812311411248
domInteractive3117137222795
firstPaint5239516824089931208
backgroundConnect24220160779228513
firstReactRender48389375062
getState19014568654197227
initialActions105112
loadScripts85367814141219281038
setupStore1674081535
numNetworkReqs71571441970133
WebpackStandard HomeuiStartup822679102878869985
load66757087176726818
domContentLoaded66256686676722812
domInteractive2614120212283
firstPaint22883864178218727
backgroundConnect1267491329
firstReactRender53322093458132
getState2914190193547
initialActions106113
loadScripts65956385775719802
setupStore1153141219
numNetworkReqs1468820673
WebpackPower User HomeuiStartup13961080207020214941792
load7255991082101803911
domContentLoaded7175921075101795903
domInteractive31171272626113
firstPaint28093939215312760
backgroundConnect977656168107573
firstReactRender50397765261
getState17614130026185246
initialActions103111
loadScripts7145901064100793900
setupStore1464371336
numNetworkReqs72582122368131
FirefoxBrowserifyStandard HomeuiStartup13941091261721814821766
load1119924231716011731302
domContentLoaded1118924231216011721301
domInteractive7832120611888142
firstPaint------
backgroundConnect60183235074179
firstReactRender40307394465
getState147202211230
initialActions103012
loadScripts1085908221114611371251
setupStore165126201254
numNetworkReqs1568421873
BrowserifyPower User HomeuiStartup25661599348351129773269
load1625956241548020622336
domContentLoaded1625955241548020622336
domInteractive16031100327584973
firstPaint------
backgroundConnect205241081246207969
firstReactRender5235178165771
getState1306024143162210
initialActions2138423
loadScripts1526941234145519462209
setupStore3734016035146
numNetworkReqs75561342184123
WebpackStandard HomeuiStartup16471350311622617472038
load13481148282017913911557
domContentLoaded13471148282017913901556
domInteractive842924846120144
firstPaint------
backgroundConnect62231824078150
firstReactRender453594105058
getState197245321542
initialActions103122
loadScripts13161133279317713571525
setupStore215178291595
numNetworkReqs1569021874
WebpackPower User HomeuiStartup26111758387450429903358
load18681154263545522992427
domContentLoaded18681154263545622992427
domInteractive249281059354219996
firstPaint------
backgroundConnect151241071186188475
firstReactRender5437107115779
getState1266726847155222
initialActions207123
loadScripts17841138253043522112400
setupStore264245372792
numNetworkReqs74481292080123
📊 Page Load Benchmark Results

Current Commit: 58ee57a | Date: 12/10/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±89ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 721ms (±87ms) 🟢 | historical mean value: 725ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 81ms (±65ms) 🟢 | historical mean value: 79ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 89ms 1.00s 1.87s 1.07s 1.87s
domContentLoaded 721ms 87ms 695ms 1.55s 747ms 1.55s
firstPaint 81ms 65ms 60ms 728ms 84ms 728ms
firstContentfulPaint 81ms 65ms 60ms 728ms 84ms 728ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 116 Bytes (0%)
  • ui: -2.38 KiB (-0.03%)
  • common: -582 Bytes (-0.01%)

metamaskbot avatar Dec 10 '25 13:12 metamaskbot

Builds ready [aadfc3b]
UI Startup Metrics (1265 ± 111 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12651012164311113381433
load104385212999510941222
domContentLoaded103784712889410881206
domInteractive2715117222293
firstPaint56889128840010161161
backgroundConnect21519624712220240
firstReactRender4532173174969
getState3717125184366
initialActions108112
loadScripts829654108491881999
setupStore1264051321
numNetworkReqs1367819670
BrowserifyPower User HomeuiStartup19401600250917320252276
load1098900145713012011321
domContentLoaded1088894144813011871316
domInteractive3118171252894
firstPaint614106146344110721336
backgroundConnect25220372892236547
firstReactRender49398575165
getState20314777182209259
initialActions102112
loadScripts87168412141279661091
setupStore1674681535
numNetworkReqs72581482068138
WebpackStandard HomeuiStartup812671110688869976
load66856794889744830
domContentLoaded66256493388738824
domInteractive2615107202384
firstPaint22577716148217643
backgroundConnect12687111235
firstReactRender4632158204791
getState281465113849
initialActions102011
loadScripts65956192887729821
setupStore1152741221
numNetworkReqs1367918668
WebpackPower User HomeuiStartup14461102186219516311723
load7506021032112865925
domContentLoaded7435941026111858918
domInteractive31171292626109
firstPaint312106960243304897
backgroundConnect77763915639558
firstReactRender50406755264
getState20210669280208322
initialActions103112
loadScripts7405911023110852915
setupStore1574881436
numNetworkReqs71571472167135
FirefoxBrowserifyStandard HomeuiStartup13781087243224414401858
load1120927209319111721345
domContentLoaded1119927209319111711345
domInteractive74319749886152
firstPaint------
backgroundConnect54212384462155
firstReactRender3931110113959
getState137127131233
initialActions102122
loadScripts1088911200918411411268
setupStore176525521135
numNetworkReqs1568221976
BrowserifyPower User HomeuiStartup26701663628264830403416
load16711031431156121272370
domContentLoaded16711031431156121262369
domInteractive18132310938598979
firstPaint------
backgroundConnect185241140220212936
firstReactRender5634110146294
getState1376524442161228
initialActions2142423
loadScripts15801011413353220362299
setupStore5053537842294
numNetworkReqs74571292171125
WebpackStandard HomeuiStartup15811326232818516811944
load12931099176111813371557
domContentLoaded12921098176111813361557
domInteractive782623141109144
firstPaint------
backgroundConnect58192854762147
firstReactRender43329394855
getState177134201550
initialActions103122
loadScripts12641084173711113111480
setupStore2362663917129
numNetworkReqs1568621876
WebpackPower User HomeuiStartup27111833535759831673487
load18351184360950822882508
domContentLoaded18351184360950822882508
domInteractive2183111463241611004
firstPaint------
backgroundConnect13926959142191285
firstReactRender5737122136278
getState1366727350170232
initialActions3138527
loadScripts17731154358149322152481
setupStore3654236239147
numNetworkReqs76572032571125
📊 Page Load Benchmark Results

Current Commit: aadfc3b | Date: 12/10/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±44ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 721ms (±39ms) 🟢 | historical mean value: 724ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±16ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 44ms 1.01s 1.39s 1.07s 1.39s
domContentLoaded 721ms 39ms 703ms 1.03s 746ms 1.03s
firstPaint 77ms 16ms 60ms 224ms 88ms 224ms
firstContentfulPaint 77ms 16ms 60ms 224ms 88ms 224ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 116 Bytes (0%)
  • ui: -2.38 KiB (-0.03%)
  • common: -582 Bytes (-0.01%)

metamaskbot avatar Dec 10 '25 15:12 metamaskbot