Skip to content

test: fix stx opt-in opt-out fixture #33264

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

seaona
Copy link
Contributor

@seaona seaona commented May 29, 2025

Description

This PR does 2 things:

  • removes the method withPreferencesControllerSmartTransactionsOptedIn from fixtures, as this value is always true by default (check the value default fixture, and for the onboarding fixture, there is logic in the app which sets this to true)
  • deprecates the method withPreferencesControllerSmartTransactionsOptedOut from fixtures, as this value is always overridden by the migration 135 which will set it to true if the value is false.

After that, I've updated the e2e accordingly.

Open in GitHub Codespaces

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MMQA-605?atlOrigin=eyJpIjoiNDEyNWNjY2I4ZmJhNDhjNDhhMDRiYjk1NmJlYWJlMGEiLCJwIjoiaiJ9

Manual testing steps

  1. Everything should continue to work as before

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

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 May 29, 2025
@seaona seaona self-assigned this May 29, 2025
@@ -845,20 +845,14 @@ class FixtureBuilder {
});
}

withPreferencesControllerSmartTransactionsOptedIn() {
Copy link
Contributor Author

@seaona seaona May 29, 2025

Choose a reason for hiding this comment

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

we don't need this method as the opt in status is already in the default fixture, or it is set to true by default in the onboarding case

/**
* @deprecated this method should not be used, as the `smartTransactionsOptInStatus` value is overridden by the migration 135
* Use the step by step flow to disable this setting.
*/
withPreferencesControllerSmartTransactionsOptedOut() {
Copy link
Contributor Author

@seaona seaona May 29, 2025

Choose a reason for hiding this comment

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

ℹ️ leaving the method with the @deprecated info, so this is not used.
I could have deleted it, but I'm afraid this can be re-introduced again, so leaving this here for a while before removing it completely.
Side: removed the tokenNetworkFilter as it's irrelevant here

@@ -26,7 +26,6 @@ describe('Gas Fee Tokens - Smart Transactions', function (this: Suite) {
dapp: true,
fixtures: new FixtureBuilder({ inputChainId: CHAIN_IDS.MAINNET })
.withPermissionControllerConnectedToTestDapp()
.withPreferencesControllerSmartTransactionsOptedIn()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is already true by default

@@ -84,7 +83,6 @@ describe('Gas Fee Tokens - Smart Transactions', function (this: Suite) {
dapp: true,
fixtures: new FixtureBuilder({ inputChainId: CHAIN_IDS.MAINNET })
.withPermissionControllerConnectedToTestDapp()
.withPreferencesControllerSmartTransactionsOptedIn()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is already true by default

@@ -27,7 +27,6 @@ async function withFixturesForSmartTransactions(
{
fixtures: new FixtureBuilder()
.withPermissionControllerConnectedToTestDapp()
.withPreferencesControllerSmartTransactionsOptedIn()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is already true by default

@seaona seaona marked this pull request as ready for review May 29, 2025 07:22
@seaona seaona changed the title test: remove stx fixture test: fix stx opt-in opt-out fixture May 29, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [1e55823]
UI Startup Metrics (1199 ± 60 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1199109114226012341305
load103393312505710641124
domContentLoaded102692812455710601118
domInteractive17135061633
firstPaint784161126838410591123
backgroundConnect84345823
firstReactRender20153132128
getState1364681728
initialActions001001
loadScripts78669692052818869
setupStore74162812
WebpackHomeuiStartup21631721255921123172500
load16761333197215918011904
domContentLoaded16691330195815817951895
domInteractive161260111351
firstPaint1696439869213313
backgroundConnect2711239312941
firstReactRender13844362106232332
getState214350541430
initialActions316135
loadScripts16651328194715717911884
setupStore4563328722310
FirefoxBrowserifyHomeuiStartup13161111180413313951588
load1169984166112512421427
domContentLoaded1168983166012512411427
domInteractive943620030102164
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2213221222147
firstReactRender23195462344
getState10418919823
initialActions001001
loadScripts1149969162812212171388
setupStore64536611
WebpackHomeuiStartup16351413223517317092096
load14021206200415814761693
domContentLoaded14021206200415814751693
domInteractive84362362789130
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect24167482644
firstReactRender44325654753
getState136260261032
initialActions102111
loadScripts13811190198215814521672
setupStore12624424928
Benchmark value 24 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 46 exceeds gate value 32 for chrome webpack home mean setupStore
Benchmark value 2501 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 310 exceeds gate value 65 for chrome webpack home p95 setupStore
Benchmark value 1635 exceeds gate value 1615 for firefox webpack home mean uiStartup
Benchmark value 1402 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1402 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 45 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 1381 exceeds gate value 1360 for firefox webpack home mean loadScripts
Benchmark value 2096 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 1693 exceeds gate value 1660 for firefox webpack home p95 load
Benchmark value 1693 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded
Benchmark value 53 exceeds gate value 50 for firefox webpack home p95 firstReactRender
Benchmark value 1672 exceeds gate value 1630 for firefox webpack home p95 loadScripts
Sum of mean exceeds: 106ms | Sum of p95 exceeds: 570ms
Sum of all benchmark exceeds: 676ms

Bundle size diffs [🚀 Bundle size reduced!]
  • background: -183 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

@metamaskbot
Copy link
Collaborator

Builds ready [196b546]
UI Startup Metrics (1193 ± 54 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1193107413415412271291
load103493111735010651119
domContentLoaded102691911635110591111
domInteractive16134351630
firstPaint73374117340210441112
backgroundConnect84285823
firstReactRender19144542027
getState1463882029
initialActions001001
loadScripts78868892250819870
setupStore75142811
WebpackHomeuiStartup20681663252022122182433
load16041250194816917351856
domContentLoaded15981244193916817281847
domInteractive15116481339
firstPaint1596532159194269
backgroundConnect20104262231
firstReactRender13943475109275327
getState1042031117
initialActions512922934
loadScripts15951241192816717261837
setupStore3873118019302
FirefoxBrowserifyHomeuiStartup13161099184913713711643
load1166974172213612251477
domContentLoaded1166974172113612251477
domInteractive904515820100127
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2012204192030
firstReactRender23195342328
getState7434489
initialActions001001
loadScripts1148960170713712051455
setupStore74346621
WebpackHomeuiStartup15671377219016216791930
load13511184195515214641602
domContentLoaded13501184195415114631600
domInteractive83493523783127
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect22156062432
firstReactRender42285844450
getState105789927
initialActions102111
loadScripts13311166193715214421581
setupStore10524324819
Benchmark value 23 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 39 exceeds gate value 32 for chrome webpack home mean setupStore
Benchmark value 302 exceeds gate value 65 for chrome webpack home p95 setupStore
Benchmark value 43 exceeds gate value 38 for firefox webpack home mean firstReactRender
Sum of mean exceeds: 12ms | Sum of p95 exceeds: 242ms
Sum of all benchmark exceeds: 254ms

Bundle size diffs [🚀 Bundle size reduced!]
  • background: -183 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 0 Bytes (0%)

jvbriones
jvbriones previously approved these changes May 29, 2025
@@ -116,6 +116,21 @@ describe('Switch Ethereum Chain for two dapps', function () {
async ({ driver }) => {
await unlockWallet(driver);

// disable smart transactions step by step
// we cannot use fixtures because migration 135 overrides the opt in value to true
await driver.clickElement(
Copy link
Contributor

@pnarayanaswamy pnarayanaswamy May 29, 2025

Choose a reason for hiding this comment

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

Maybe nice to use the toggleSmartTransactions function from the already existing page test/e2e/page-objects/pages/settings/advanced-settings.ts here?

Copy link
Contributor Author

@seaona seaona May 29, 2025

Choose a reason for hiding this comment

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

good catch. I haven't used any page object related methods in this spec, because this test is not migrated yet and we have a weak validation for "knowing" which tests are using page objects, by checking imports.
If I added this method, it would "seem" as we are using page objects here, but that won't be accurate.
That's why I continued the legacy approach from the test, and once this is migrated altogether, the validation will accurately show that's a migrated test.

We could improve the logic for that validation in a separate PR, to handle cases where "mixed-approaches" are made

Copy link
Contributor Author

@seaona seaona May 29, 2025

Choose a reason for hiding this comment

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

ℹ️ Adding the flow for the spec using page objects only (eip7702 one), and we can use this flow to this specific legacy test once that is migrated

@metamaskbot
Copy link
Collaborator

Builds ready [7425610]
UI Startup Metrics (1216 ± 71 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1216108914277112671351
load104893512356210961148
domContentLoaded104092812176310881140
domInteractive17133551631
firstPaint69073118841910591140
backgroundConnect94466824
firstReactRender19163232028
getState1565182027
initialActions001001
loadScripts79968997263850899
setupStore84263811
WebpackHomeuiStartup21341704284621022722459
load16521325211715717591869
domContentLoaded16421321209415517531860
domInteractive151169101348
firstPaint1626237361208289
backgroundConnect2610332332457
firstReactRender15544370113299338
getState154310321241
initialActions319134
loadScripts16391319208315417511852
setupStore3663097018259
FirefoxBrowserifyHomeuiStartup13631180173411214241624
load12061027157210712671415
domContentLoaded12051026157210712661415
domInteractive1033733644119161
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2414215232250
firstReactRender24215962432
getState94779917
initialActions001001
loadScripts11861012155510612501399
setupStore74395716
WebpackHomeuiStartup15131339197813415991801
load13111161172512613821579
domContentLoaded13111161172412513821579
domInteractive76351431679108
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2315221212233
firstReactRender40275444348
getState12523223930
initialActions002111
loadScripts12911147170412213621553
setupStore85304817
Benchmark value 25 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 37 exceeds gate value 32 for chrome webpack home mean setupStore
Benchmark value 2460 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 259 exceeds gate value 65 for chrome webpack home p95 setupStore
Benchmark value 40 exceeds gate value 38 for firefox webpack home mean firstReactRender
Sum of mean exceeds: 7ms | Sum of p95 exceeds: 207ms
Sum of all benchmark exceeds: 214ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: -183 Bytes (0%)
  • ui: 2.36 KiB (0.03%)
  • common: 39.02 KiB (0.48%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-qa QA team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants