Skip to content

test: add checkInstallationComplete into snap install flow and add state readiness check - #46863

Merged
Unik0rnMaggie merged 3 commits into
mainfrom
test/snap-install-flow-refactor
Oct 26, 2026
Merged

Unik0rnMaggie merged 3 commits into
mainfrom
test/snap-install-flow-refactor

Conversation

@Unik0rnMaggie

@Unik0rnMaggie Unik0rnMaggie commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Refactors the snap E2E test install flow to streamline the specs and fix a race-condition-driven flakiness.

  1. openTestSnapClickButtonAndInstall absorbs checkInstallationComplete: 25 spec files previously called the flow and then separately called testSnaps.checkInstallationComplete() right after.
    Now they pass expectedMessage as an option and the flow handles it internally.

  2. Deterministic snap-ready state check: after install, the flow can now poll MetaMask's Redux state via getCleanAppState to confirm the snap is enabled and no longer in installing status before returning. This ensures the background has fully committed the snap install before the test continues.

  3. Removed temporary retry from openGlobalMenu: PR #46503 added a retry block to header-navbar.ts as a temporary fix for a flaky homepage snap test.

  4. Fixed localhost to 127.0.0.1 in test-snap-dialog and test-snap-networkaccess: both tests were failing locally because the dapp page failed to open when using localhost.

Changelog

CHANGELOG entry: null

Related issues

Fixes: MMQA-2441

Manual testing steps

  1. Run the test to make sure they pass

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

Low Risk
Changes are limited to E2E test helpers, mocks, and specs with no production wallet or security logic touched.

Overview
Refactors Snap E2E install helpers to centralize post-install waits and cut race-driven flakiness.

openTestSnapClickButtonAndInstall now accepts expectedMessage (runs the former per-spec checkInstallationComplete on the connect button) and optional snapId (polls MetaMask Redux via getCleanAppState until the snap is enabled and not installing). Dozens of snap specs pass these options instead of duplicating install-complete checks.

Other test fixes: the test-snaps site mock proxies fetches to 127.0.0.1 instead of localhost; openGlobalMenu drops a temporary double-click retry now that install timing is handled in the flow; dialog spec drops a redundant localhost URL override.

Reviewed by Cursor Bugbot for commit 3191544. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
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.

@github-actions github-actions Bot added the size-M label Oct 5, 2026
@Unik0rnMaggie Unik0rnMaggie added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed e2e-maintenance labels Oct 5, 2026
cmd-ob
cmd-ob previously approved these changes Oct 5, 2026
hjetpoluru
hjetpoluru previously approved these changes Oct 5, 2026

@hjetpoluru hjetpoluru left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes LGTM. The failure appears to be related to the AWS downtime, so I’m approving the PR but the tests needs to be rerun again

@metamask-ci

metamask-ci Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

✨ Files requiring CODEOWNER review ✨

🫰 @MetaMask/core-platform (28 files, +71 -160)
  • 📁 test/
    • 📁 e2e/
      • 📁 mock-response-data/
        • 📁 snaps/
          • 📁 snap-local-sites/
            • 📄 test-snaps-site-mocks.ts +1 -1
      • 📁 snaps/
        • 📄 test-snap-background-events.spec.ts +3 -13
        • 📄 test-snap-bip-32.spec.ts +1 -6
        • 📄 test-snap-bip-44.spec.ts +1 -6
        • 📄 test-snap-cronjob-duration.spec.ts +1 -6
        • 📄 test-snap-cronjob.spec.ts +1 -4
        • 📄 test-snap-dialog.spec.ts +2 -6
        • 📄 test-snap-ethereum-provider.spec.ts +1 -4
        • 📄 test-snap-get-file.spec.ts +5 -3
        • 📄 test-snap-get-locale.spec.ts +1 -4
        • 📄 test-snap-get-preferences.spec.ts +1 -4
        • 📄 test-snap-homepage.spec.ts +1 -0
        • 📄 test-snap-installed.spec.ts +5 -5
        • 📄 test-snap-interactive-ui.spec.ts +1 -4
        • 📄 test-snap-jsx.spec.ts +3 -5
        • 📄 test-snap-lifecycle.spec.ts +4 -8
        • 📄 test-snap-managestate.spec.ts +4 -9
        • 📄 test-snap-metrics.spec.ts +10 -18
        • 📄 test-snap-multichain-provider.spec.ts +1 -5
        • 📄 test-snap-networkaccess.spec.ts +1 -4
        • 📄 test-snap-notification.spec.ts +2 -8
        • 📄 test-snap-revoke-perm.spec.ts +1 -4
        • 📄 test-snap-siginsights.spec.ts +5 -7
        • 📄 test-snap-ui-imgs.spec.ts +3 -5
        • 📄 test-snap-uilinks.spec.ts +5 -3
        • 📄 test-snap-update-component.spec.ts +1 -6
        • 📄 test-snap-update.spec.ts +3 -5
        • 📄 test-snap-wasm.spec.ts +3 -7

🧪 @MetaMask/qa (2 files, +34 -8)
  • 📁 test/
    • 📁 e2e/
      • 📁 page-objects/
        • 📁 flows/
          • 📄 install-test-snap.flow.ts +33 -2
        • 📁 pages/
          • 📁 home/
            • 📄 header-navbar.ts +1 -6

@metamask-ci

metamask-ci Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor
Builds ready [3191544]
⚡ Performance Benchmarks (Total: 🟢 8 pass · 🟡 2 warn · 🔴 3 fail)

Baseline (latest main): 171ed20 | Date: 7/28/2026 | Pipeline: 37796141903 | Baseline logs

Metricschrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 load_new_account(p95) [CI log]🔴 load_new_account(p95) [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]

Regressions (🔴 3 failures)

Interaction Benchmarks · Samples: 5 🔴 2
Benchmarkchrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 [CI log]
🔴 load_new_account
🔴 [CI log]
🔴 load_new_account
confirmTx
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
bridgeUserActions
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↑ loadNewAccount/load_new_account: +417%
  • ↑ loadNewAccount/total: +417%
  • ↓ loadNewAccount/inp: -24%
  • ↑ confirmTx/longTaskCount: +33%
  • ↑ confirmTx/longTaskTotalDuration: +47%
  • ↑ confirmTx/longTaskMaxDuration: +54%
  • ↑ confirmTx/tbt: +62%
  • ↑ confirmTx/inp: +36%
  • ↑ bridgeUserActions/bridge_load_page: +39%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +71%
  • ↑ bridgeUserActions/longTaskCount: +67%
  • ↑ bridgeUserActions/longTaskTotalDuration: +76%
  • ↑ bridgeUserActions/longTaskMaxDuration: +16%
  • ↑ bridgeUserActions/tbt: +100%
  • ↓ bridgeUserActions/inp: -15%
  • ↑ loadNewAccount/load_new_account: +418%
  • ↑ loadNewAccount/total: +418%
  • ↓ loadNewAccount/inp: -24%
  • ↓ loadNewAccount/fcp: -41%
  • ↑ loadNewAccount/lcp: +1179%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/inp: -32%
  • ↑ confirmTx/fcp: +21%
  • ↑ confirmTx/lcp: +1242%
  • ↑ bridgeUserActions/bridge_load_page: +266%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +155%
  • ↑ bridgeUserActions/bridge_search_token: +56%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +78%
  • ↑ bridgeUserActions/inp: +38%
  • ↓ bridgeUserActions/fcp: -42%
  • ↑ bridgeUserActions/lcp: +1199%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 confirmTx/FCP: p75 2.1s
Startup Benchmarks · Samples: 100
Benchmarkchrome-webpackfirefox-webpack
startupStandardHome
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 loadScripts

📈 Results compared to the previous 5 runs on main

  • ↓ startupStandardHome/firstReactRender: -99%
  • ↓ startupStandardHome/initialActions: -33%
  • ↑ startupStandardHome/setupStore: +89%
  • ↑ startupStandardHome/numNetworkReqs: +10%
  • ↓ startupStandardHome/longTaskCount: -33%
  • ↑ startupStandardHome/load: +13%
  • ↑ startupStandardHome/domContentLoaded: +13%
  • ↓ startupStandardHome/domInteractive: -19%
  • ↑ startupStandardHome/backgroundConnect: +12%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -50%
  • ↑ startupStandardHome/loadScripts: +13%
  • ↑ startupStandardHome/setupStore: +190%
  • ↓ startupStandardHome/fcp: -13%
  • ↑ startupStandardHome/lcp: +16%
User Journey Benchmarks · Samples: 5 · mock API 🔴 1
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]
🔴 total

📈 Results compared to the previous 5 runs on main

  • ↑ onboardingImportWallet/srpButtonToSrpForm: +48%
  • ↑ onboardingImportWallet/confirmSrpToPwForm: +51%
  • ↑ onboardingImportWallet/pwFormToMetricsScreen: +37%
  • ↑ onboardingImportWallet/metricsToWalletReadyScreen: +24%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -94%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -75%
  • ↓ onboardingImportWallet/longTaskCount: -86%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -96%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -93%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -89%
  • ↑ onboardingNewWallet/srpButtonToPwForm: +36%
  • ↑ onboardingNewWallet/createPwToRecoveryScreen: +20%
  • ↑ onboardingNewWallet/skipBackupToMetricsScreen: +30%
  • ↑ onboardingNewWallet/agreeButtonToOnboardingSuccess: +11%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -83%
  • ↓ onboardingNewWallet/longTaskCount: -69%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -79%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -50%
  • ↓ onboardingNewWallet/tbt: -98%
  • ↓ onboardingNewWallet/total: -79%
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-webpack
dappPageLoad
[Sentry log · main/release]
🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↓ dappPageLoad/pageLoadTime: -56%
  • ↓ dappPageLoad/firstPaint: -37%
  • ↓ dappPageLoad/firstContentfulPaint: -37%
Bundle Size Diffs
Status Bundle Total Diff Change
✅ background 15.59 MiB +120 Bytes 0.00%
✅ ui 19.23 MiB +60 Bytes 0.00%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.53 MiB 0 Bytes 0.00%
✅ content scripts 3.26 MiB 0 Bytes 0.00%
✅ zip 23.9 MiB +47 Bytes 0.00%

@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

}

const localUrl = `http://localhost:${port}${localPath}${url.search}`;
const localUrl = `http://127.0.0.1:${port}${localPath}${url.search}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was this needed? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. On macOS localhost can resolve to ::1 (IPv6) but the test dapp server only binds to 127.0.0.1 (IPv4), causing connection failures locally.
No impact on CI since Linux always maps localhost to 127.0.0.1.

@Unik0rnMaggie
Unik0rnMaggie added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 200e9a8 Oct 26, 2026
140 of 141 checks passed
@Unik0rnMaggie
Unik0rnMaggie deleted the test/snap-install-flow-refactor branch October 26, 2026 09:14
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 26, 2026
@metamaskbot metamaskbot added the release-13.56.0 Issue or pull request that will be included in release 13.56.0 label Nov 2, 2026

This branch was previously deployed

1 inactive deployment
pr-comment — 3191544e Deployed Oct 8, 2026 by Unik0rnMaggie via Publish prerelease / Publish prerelease #168409
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

e2e-maintenance no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-13.56.0 Issue or pull request that will be included in release 13.56.0 size-M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants