Skip to content
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: move Snap component tests into their own files #31361

Merged
merged 22 commits into from
Mar 31, 2025

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented Mar 27, 2025

Description

Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions:

  1. What is the reason for the change? snap-ui-renderer.test.js was quickly becoming a mess with all of the snap component tests in there.
  2. What is the improvement/solution? Break the component tests out into their respective files and make the test setup re-usable.

Related issues

Fixes: #31292

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.

@hmalik88 hmalik88 added the team-snaps-platform Snaps Platform team label Mar 27, 2025
Copy link
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.

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Mar 27, 2025
@hmalik88 hmalik88 marked this pull request as ready for review March 27, 2025 16:56
@hmalik88 hmalik88 requested a review from a team as a code owner March 27, 2025 16:56
@metamaskbot
Copy link
Collaborator

Builds ready [bbc840e]
UI Startup Metrics (1189 ± 56 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1189109914865612201284
load10459251359571359990
domContentLoaded1038919134556955985
domInteractive17137091529
firstPaint8031271354383240982
backgroundConnect10651689
firstReactRender19145251930
getState10434768
initialActions001001
loadScripts788666107655821864
setupStore7519278
WebpackHomeuiStartup934838117657959980
load79860497766841875
domContentLoaded79259496866836871
domInteractive15124071436
firstPaint44252971332821876
backgroundConnect15113451528
firstReactRender14122421316
getState6319268
initialActions001001
loadScripts79058495866835862
setupStore7512189
FirefoxBrowserifyHomeuiStartup14211219203715614581823
load12671084185614813051651
domContentLoaded12671083185614813041651
domInteractive11539308398697
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect261783112852
firstReactRender25205762634
getState8451779
initialActions002001
loadScripts12421066183614712851624
setupStore7439567
WebpackHomeuiStartup10048221611166906962
load8747111410146827945
domContentLoaded8747111410146826945
domInteractive110352162915592
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect221497142561
firstReactRender20162922025
getState105751178
initialActions001001
loadScripts8576961379143833987
setupStore8563789
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@hmalik88 hmalik88 removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Mar 27, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [63f8c77]
UI Startup Metrics (1267 ± 67 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1267113114596713111382
load1117100713006611591240
domContentLoaded1111100212956611531234
domInteractive181481101635
firstPaint7881361302431206280
backgroundConnect106304910
firstReactRender21155372137
getState12339769
initialActions001001
loadScripts853739102965893966
setupStore8417378
WebpackHomeuiStartup966859111854969996
load82158497466866903
domContentLoaded81557796166860899
domInteractive16125071436
firstPaint44457903341844893
backgroundConnect16123241626
firstReactRender1712298281416
getState7414278
initialActions001000
loadScripts81356695967859894
setupStore8514289
FirefoxBrowserifyHomeuiStartup13381172197114413611694
load11991027179813812281545
domContentLoaded11981027179813812271545
domInteractive10237231288899
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2616133192340
firstReactRender23195462534
getState7323378
initialActions001001
loadScripts11741012176213611981523
setupStore6333567
WebpackHomeuiStartup9748421530169897984
load8547411339153786864
domContentLoaded8547401338153786863
domInteractive113411912213694
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect211384102332
firstReactRender19163531923
getState94731079
initialActions002001
loadScripts8377271318149773858
setupStore8583878
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [e59a841]
UI Startup Metrics (1259 ± 57 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1259113814665712891359
load1104100012275211361200
domContentLoaded109999612145211411210
domInteractive191479141676
firstPaint782781219436206304
backgroundConnect106505910
firstReactRender21164952134
getState12451969
initialActions001001
loadScripts83873795151878926
setupStore8527379
WebpackHomeuiStartup922828107453938957
load79669391553825881
domContentLoaded79068690853820875
domInteractive15114371333
firstPaint52367891319816839
backgroundConnect14102441524
firstReactRender13121511314
getState6311178
initialActions001001
loadScripts78868589852816865
setupStore7411189
FirefoxBrowserifyHomeuiStartup14581249213018314721968
load13041122196617813161805
domContentLoaded13041122196517813161805
domInteractive116402523218796
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2617128132637
firstReactRender24195952530
getState8441679
initialActions001001
loadScripts12791099194217712931781
setupStore8442768
WebpackHomeuiStartup10698991681169945982
load9307801483155853937
domContentLoaded9307801483155852937
domInteractive117322213015195
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect231487102734
firstReactRender21172922125
getState9558689
initialActions002001
loadScripts9097651452152836921
setupStore125631389
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

metamaskbot commented Mar 27, 2025

✨ Files requiring CODEOWNER review ✨

🫰 @MetaMask/snaps-devs

  • ui/components/app/snaps/snap-ui-renderer/__snapshots__/snap-ui-renderer.test.js.snap
  • ui/components/app/snaps/snap-ui-renderer/components/__snapshots__/address-input.test.ts.snap
  • ui/components/app/snaps/snap-ui-renderer/components/__snapshots__/file-input.test.ts.snap
  • ui/components/app/snaps/snap-ui-renderer/components/__snapshots__/form.test.ts.snap
  • ui/components/app/snaps/snap-ui-renderer/components/address-input.test.ts
  • ui/components/app/snaps/snap-ui-renderer/components/file-input.test.ts
  • ui/components/app/snaps/snap-ui-renderer/components/form.test.ts
  • ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.test.js
  • ui/components/app/snaps/snap-ui-renderer/test-utils.tsx

@metamaskbot
Copy link
Collaborator

Builds ready [389e90b]
UI Startup Metrics (1192 ± 59 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1192107413315912391288
load10399461182541182989
domContentLoaded1034935117654942985
domInteractive16133341526
firstPaint790951164387245966
backgroundConnect106474910
firstReactRender18153441831
getState11450868
initialActions001001
loadScripts82170895954865906
setupStore8526378
WebpackHomeuiStartup916813115967936953
load77857898369819878
domContentLoaded77256897970812870
domInteractive15123661331
firstPaint48554983333813834
backgroundConnect16115391541
firstReactRender14122631324
getState7427368
initialActions001000
loadScripts76955896971811860
setupStore7416278
FirefoxBrowserifyHomeuiStartup13981228204516614241813
load12581107189816312951652
domContentLoaded12581107189716312951652
domInteractive11237200318297
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect23185042430
firstReactRender23195442429
getState7440478
initialActions001011
loadScripts12371089187316112761622
setupStore7434469
WebpackHomeuiStartup9718141439159887980
load8517121313143799965
domContentLoaded8517121313143798965
domInteractive115362532815896
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2012109132031
firstReactRender19163531924
getState93631179
initialActions001001
loadScripts8347001291139784958
setupStore7452578
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [8bc0f60]
UI Startup Metrics (1179 ± 64 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1179106214736412181283
load1029906124261936990
domContentLoaded1023899123261929986
domInteractive15123841525
firstPaint7041361241412232988
backgroundConnect10653799
firstReactRender19144251933
getState11436769
initialActions001001
loadScripts814694101959860904
setupStore7421279
WebpackHomeuiStartup943809123372954973
load80160096565834892
domContentLoaded79658195466829882
domInteractive15124261333
firstPaint48066957335826847
backgroundConnect16115391440
firstReactRender14123231323
getState6414278
initialActions001001
loadScripts79457194366827871
setupStore7514278
FirefoxBrowserifyHomeuiStartup13811195200115314141744
load12381074181714112831571
domContentLoaded12371074181714112831571
domInteractive9936178259098
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2716200212640
firstReactRender23195142429
getState8446678
initialActions001001
loadScripts12121058179413912611543
setupStore6434467
WebpackHomeuiStartup9928241515150929987
load8667181328129828950
domContentLoaded8657181327129828950
domInteractive118392242414699
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect21137892338
firstReactRender19163232025
getState8462879
initialActions001001
loadScripts8487051304126828947
setupStore105781379
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [1f3aa90]
UI Startup Metrics (1183 ± 57 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1183106813115712221302
load1029943116452951978
domContentLoaded1023939115952947977
domInteractive16133241528
firstPaint761821150387264975
backgroundConnect10751589
firstReactRender19154851931
getState10429768
initialActions001001
loadScripts81172593552841901
setupStore8531378
WebpackHomeuiStartup948820127380952970
load80868897158838890
domContentLoaded80267396057831877
domInteractive15124071435
firstPaint45954951342825878
backgroundConnect16114681539
firstReactRender14123441325
getState6412278
initialActions001001
loadScripts80066394957830875
setupStore7415279
FirefoxBrowserifyHomeuiStartup13731150183714514101742
load12351035170413912921583
domContentLoaded12351035170413912911583
domInteractive9840176279196
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect26167192843
firstReactRender22195042327
getState7435479
initialActions001001
loadScripts12101015168413612671542
setupStore6426368
WebpackHomeuiStartup9828331600176897971
load8627291371156804903
domContentLoaded8627281371156803903
domInteractive110401842113797
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2013108142133
firstReactRender18162721923
getState931011279
initialActions001001
loadScripts8467141342153793930
setupStore8462878
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [9d5eb06]
UI Startup Metrics (1170 ± 58 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1170106214025811991271
load1023927121755951993
domContentLoaded1017923120755951996
domInteractive16123341526
firstPaint7121301219401248981
backgroundConnect96212910
firstReactRender19144451934
getState11439768
initialActions001001
loadScripts80569498255831904
setupStore8528378
WebpackHomeuiStartup955752127079966993
load80762398770848909
domContentLoaded80260998371841898
domInteractive16124881436
firstPaint41655978339832864
backgroundConnect16125691542
firstReactRender14123231424
getState7313278
initialActions001000
loadScripts79959898171838887
setupStore8518289
FirefoxBrowserifyHomeuiStartup13871202202115514131748
load12501068187215012861585
domContentLoaded12501067187215012861584
domInteractive11040268339098
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2616136162541
firstReactRender22193332427
getState6437478
initialActions001001
loadScripts12251024184714912691560
setupStore6423366
WebpackHomeuiStartup9928591474140921984
load8677401320126829978
domContentLoaded8677391320126829976
domInteractive114351652915094
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect211385132436
firstReactRender19162921925
getState8453789
initialActions001001
loadScripts8507241287123815958
setupStore8539588
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [5166d35]
UI Startup Metrics (1213 ± 59 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1213110113585912531325
load10539681201541134992
domContentLoaded10479641177531172994
domInteractive17133451632
firstPaint8411491189368239980
backgroundConnect107314910
firstReactRender19154941929
getState12436878
initialActions001001
loadScripts82974296252855942
setupStore8518278
WebpackHomeuiStartup921719117971945969
load77858890866826858
domContentLoaded77358590067822850
domInteractive15124071337
firstPaint39353903327811895
backgroundConnect16115591437
firstReactRender14122831324
getState6321278
initialActions001000
loadScripts77058289067821841
setupStore7514279
FirefoxBrowserifyHomeuiStartup13891177205416013961846
load12491062189015312611656
domContentLoaded12491062189015312611656
domInteractive9840203269197
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2516143142534
firstReactRender23195252431
getState6431378
initialActions001001
loadScripts12261046187015012421630
setupStore6412267
WebpackHomeuiStartup9868221743186894973
load8627151558164823939
domContentLoaded8617151557164822939
domInteractive114412002416598
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2113148162131
firstReactRender19163731926
getState1031051379
initialActions001001
loadScripts8447001420156818951
setupStore95961179
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@hmalik88 hmalik88 enabled auto-merge March 31, 2025 14:23
@hmalik88 hmalik88 added this pull request to the merge queue Mar 31, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [7aa3c9e]
UI Startup Metrics (1201 ± 67 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1201108914906712331350
load10479421321661172983
domContentLoaded1040938131566941994
domInteractive17135961629
firstPaint7891291320393247984
backgroundConnect13714919910
firstReactRender20124562136
getState12434778
initialActions001001
loadScripts822719108865843899
setupStore8515279
WebpackHomeuiStartup959768133079960983
load81761192459844903
domContentLoaded81159491459837892
domInteractive16124571436
firstPaint50455917347835912
backgroundConnect16115291540
firstReactRender14123141324
getState7415278
initialActions001000
loadScripts80958390459835882
setupStore7514289
FirefoxBrowserifyHomeuiStartup14741232200715415451795
load13261109180715214111634
domContentLoaded13251108180715214111634
domInteractive12141259364198
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2718262242634
firstReactRender24204132529
getState7426389
initialActions001001
loadScripts13001091176914613911605
setupStore6413268
WebpackHomeuiStartup9698111564160892980
load8497091387142826935
domContentLoaded8497091387142826935
domInteractive114391872014897
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect201285102130
firstReactRender18162521823
getState94891179
initialActions001001
loadScripts8336971368139807926
setupStore95841178
Bundle size diffs
  • background: 0 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

Merged via the queue into main with commit 56a90ac Mar 31, 2025
147 checks passed
@hmalik88 hmalik88 deleted the hm/refactor-snap-component-tests branch March 31, 2025 15:54
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2025
@metamaskbot metamaskbot added the release-12.17.0 Issue or pull request that will be included in release 12.17.0 label Mar 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.17.0 Issue or pull request that will be included in release 12.17.0 team-snaps-platform Snaps Platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make test setup in SnapUIRenderer re-usable
6 participants