Skip to content

fix: flaky test Snap Multi Install test multi install snap#40740

Closed
Unik0rnMaggie wants to merge 2 commits intomainfrom
cursor/snap-multi-install-test-cd37
Closed

fix: flaky test Snap Multi Install test multi install snap#40740
Unik0rnMaggie wants to merge 2 commits intomainfrom
cursor/snap-multi-install-test-cd37

Conversation

@Unik0rnMaggie
Copy link
Contributor

Fixes flaky Test Snap Multi Install by waiting for the "Connection request" header before clicking "Connect".

The test was encountering a TimeoutError because it could click a disabled "Connect" button during the snap's loading state, preventing the "Add to MetaMask" dialog from appearing. This fix ensures the dialog is in the expected "Connection request" state before proceeding, mirroring a previous fix for similar snap install tests.


Slack Thread

Open in Web Open in Cursor 

…in multi-install snap test

The test was failing with TimeoutError waiting for the 'Add to MetaMask'
h3 element. This is the same root cause fixed in dd2eb8f for other
snap tests via the SnapInstall page object.

The race condition: without waiting for the 'Connection request' header,
the test could click a disabled 'Connect' button (shown during the snap
install loading state), causing the dialog to never advance to the 'Add
to MetaMask' screen.

Fix mirrors the pattern applied in snap-install.ts page object:
wait for 'Connection request' h3 before clicking Connect.

Co-authored-by: Unik0rnMaggie <Unik0rnMaggie@users.noreply.github.com>
@cursor
Copy link

cursor bot commented Mar 10, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 10, 2026

✨ Files requiring CODEOWNER review ✨

🫰 @MetaMask/core-platform (1 files, +14 -5)
  • 📁 test/
    • 📁 e2e/
      • 📁 snaps/
        • 📄 test-snap-multi-install.spec.js +14 -5

@Unik0rnMaggie Unik0rnMaggie changed the title Snap multi install test fix: flaky test Snap Multi Install test multi install snap Mar 10, 2026
…snap test

The CI logs show the 'Connect' click was on the correct Connection
Request button, but the subsequent waitForSelector for h3 'Add to
MetaMask' timed out after 10131ms (the default 10s threshold).

The snap binary download (bip32-example-snap-2.3.0.tgz) + multiple
acl.execution.metamask.io registry/signature verification calls take
slightly over 10 seconds in CI, causing the default timeout to expire
before the install dialog renders.

Increase the timeout to 30s for this specific selector which requires
snap binary download and ACL registry verification to complete.

Co-authored-by: Unik0rnMaggie <Unik0rnMaggie@users.noreply.github.com>
@cursor cursor bot temporarily deployed to pr-comment March 10, 2026 08:59 Inactive
@github-actions github-actions bot added size-S and removed size-XS labels Mar 10, 2026
@Unik0rnMaggie Unik0rnMaggie added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Mar 10, 2026
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Mar 10, 2026
@sonarqubecloud
Copy link

@cursor cursor bot temporarily deployed to pr-comment March 10, 2026 09:25 Inactive
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Mar 10, 2026

Builds ready [f9fa803]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account2912862964291296
total2912862964291296
Confirm Txconfirm_tx6162611562163561836216
total6162611562163561836216
Bridge User Actionsbridge_load_page25519930843282308
bridge_load_asset_picker20416125230215252
bridge_search_token7837697929789792
total1232118912663012571266
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup13401149163710713721545
load111791914409711531297
domContentLoaded111091513719411471285
domInteractive2616128192377
firstPaint192641383211198335
backgroundConnect19417924914194229
firstReactRender2012161152032
initialActions108123
loadScripts9317371186939671110
setupStore1262951323
numNetworkReqs3122102212289
Power User HomeuiStartup18571563280916319372094
load1086962204716310761499
domContentLoaded1069950191515410631488
domInteractive3318135223198
firstPaint194621978197226354
backgroundConnect28324545536290364
firstReactRender22155272441
initialActions108113
loadScripts87377216551488681274
setupStore1484571525
numNetworkReqs70361804655173
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2182162202219220
srpButtonToSrpForm94939719597
confirmSrpToPwForm21212202222
pwFormToMetricsScreen15151501515
metricsToWalletReadyScreen16151711617
doneButtonToHomeScreen722591823100818823
openAccountMenuToAccountListLoaded28812495313424231003134
total39703682433122140794331
Onboarding New WalletcreateWalletToSocialScreen2192172211220221
srpButtonToPwForm1111081132112113
createPwToRecoveryScreen999099
skipBackupToMetricsScreen36363713637
agreeButtonToOnboardingSuccess17171701717
doneButtonToAssetList54948659444587594
total94187998544980985
Asset DetailsassetClickToPriceChart1369318038180180
total1369318038180180
Solana Asset DetailsassetClickToPriceChart80778328283
total80778328283
Import Srp HomeloginToHomeScreen20631885233115821422331
openAccountMenuAfterLogin463662114962
homeAfterImportWithNewWallet24682256265914926122659
total45924360487319046774873
Send TransactionsopenSendPageFromHome23182842528
selectTokenToSendFormLoaded19192211922
reviewTransactionToConfirmationPage86384789318860893
total90388993719897937
SwapopenSwapPageFromHome44335485254
fetchAndDisplaySwapQuotes2699268827201427112720
total2743272127722127652772
🌐 Dapp Page Load Benchmarks

Current Commit: f9fa803 | Date: 3/10/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±84ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 739ms (±109ms) 🟢 | historical mean value: 732ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 88ms (±91ms) 🟢 | historical mean value: 83ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 84ms 1.02s 1.85s 1.07s 1.85s
domContentLoaded 739ms 109ms 711ms 1.80s 758ms 1.80s
firstPaint 88ms 91ms 60ms 988ms 88ms 988ms
firstContentfulPaint 88ms 91ms 60ms 988ms 88ms 988ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 5.15 MiB (100%)
  • ui: 8.24 MiB (100%)
  • common: 10.99 MiB (100%)

tag: 'h3',
text: 'Add to MetaMask',
},
{ timeout: 30000 },
Copy link
Member

@seaona seaona Mar 10, 2026

Choose a reason for hiding this comment

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

Adding 30 seconds timeout doesn't fix the root cause.
The error is this:

Image

However we are mocking that request, we should investigate in that line. Possilby something isn't ready when we make the call (the first check might mitigate it)

text: 'Connection request',
tag: 'h3',
});

Copy link
Member

Choose a reason for hiding this comment

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

this might fix the issue. We wait until the page is fully loaded before proceeding. However, it would be better if the whole test is migrated to page objects and then we can use page object methods instead of hardcoding a fix here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you very much! Closing this PR and added a new one to migrate the whole test

@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed size-S team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants