Skip to content

test: add MM Connect Wagmi and EVM Appwright E2E tests#21978

Merged
jiexi merged 103 commits intomainfrom
jl/mm-connect-e2e-multichain-test-dapp
Jan 23, 2026
Merged

test: add MM Connect Wagmi and EVM Appwright E2E tests#21978
jiexi merged 103 commits intomainfrom
jl/mm-connect-e2e-multichain-test-dapp

Conversation

@jiexi
Copy link
Copy Markdown
Member

@jiexi jiexi commented Oct 30, 2025

Description

Adds appwright tests for testing the MM Connect flows via native browser on Android for our EVM and Wagmi test dapps

Changelog

CHANGELOG entry: null

Related issues

Requires: MetaMask/connect-monorepo#96

Manual testing steps

1. Pull https://github.com/MetaMask/connect-monorepo
2. yarn && yarn build
3. Run appropriate test dapp locally integrations/wagmi or playground/legacy-evm-react-vite-playground using yarn dev --host

4. In the mobile repo, update appwright/appwright.config.ts for the mm-connect-android-local entry
5. You will need a prefined SRP android build. You can find one here.
6. Add entry for E2E_PASSWORD in .js.env and source it with source .js.env. You can get the password from someone in slack.
7. Determine which appwright/tests/mm-connect/connection-*.spec.js you want to run
8. Update the dapp url constant to use 10.0.2.2 for the host
9. Ensure the other tests in the suite are marked .skip
10. yarn appwright test --project mm-connect-android-local --config appwright/appwright.config.ts
11. Note that you will need to reset the browser state to be on a new tab page between every run

Browerstack build: bs://e8d331895fc40982210e32d12db75489196b05ec

Screenshots/Recordings

WAGMI Test Dapp

Screen.Recording.2026-01-07.at.1.44.54.PM.mov

EVM Legacy Test Dapp

Screen.Recording.2026-01-07.at.1.53.41.PM.mov

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

Introduces automated Android E2E coverage for MM Connect flows using Appwright.

  • Adds tests: connection-evm.spec.js, connection-wagmi.spec.js, and updates connection-multichain.spec.js
  • New utilities: AppwrightHelpers (native/webview context switching), tapByCoordinates, updated selectors; refactors utils/MobileBrowser.js and adds refresh/navigation helpers
  • New/expanded screen objects: MultiChainEvmTestDapp, WagmiTestDapp, AddChainModal, SignModal, SwitchChainModal, enhanced DappConnectionModal, and Chrome menu/refresh in MobileBrowser
  • Patches appwright to start Appium with --allow-insecure=chromedriver_autodownload and set capabilities includeSafariInWebviews and chromedriverAutodownload
  • Dependency updates: add appium-adb, appium-chromium-driver, @playwright/test; update depcheck ignores and Podfile lock for react-native-keyboard-controller
  • README fixes for flows import paths

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

@github-actions
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.

@metamaskbot metamaskbot added the team-wallet-integrations Wallet Integrations team label Oct 30, 2025
@jiexi jiexi changed the title use updated multichain test dapp WIP: Playwright E2E MM Connect Updated multichain test dapp Oct 30, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.89%. Comparing base (d3e5ee1) to head (40ac707).
⚠️ Report is 51 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21978      +/-   ##
==========================================
+ Coverage   79.86%   79.89%   +0.03%     
==========================================
  Files        4218     4232      +14     
  Lines      107888   108501     +613     
  Branches    22558    22709     +151     
==========================================
+ Hits        86163    86686     +523     
- Misses      15704    15748      +44     
- Partials     6021     6067      +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jiexi jiexi requested review from a team as code owners November 7, 2025 19:37
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

} from '../../utils/MobileBrowser.js';
import WalletMainScreen from '../../../wdio/screen-objects/WalletMainScreen.js';
import MultiChainTestDapp from '../../../wdio/screen-objects/MultiChainTestDapp.js';
import MultiChainEvmTestDapp from '../../../wdio/screen-objects/MultiChainEvmTestDapp.js';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unused import of MultiChainEvmTestDapp

Low Severity

MultiChainEvmTestDapp is imported but never used in the test file. The test only sets device on MultiChainTestDapp and uses its methods. The MultiChainEvmTestDapp import appears to have been accidentally added during development and left behind.

Fix in Cursor Fix in Web

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

return MobileBrowserScreen.tapChromeRefreshButton();
}
throw new Error('Unsupported platform');
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing device assignment in refreshMobileBrowser causes silent failures

Medium Severity

The refreshMobileBrowser function does not set MobileBrowserScreen.device = device before calling screen object methods, unlike navigateToDappAndroid which correctly sets it. The MobileBrowserScreen methods check if (!this._device) and silently return without performing any action. If refreshMobileBrowser is called without navigateToDapp being called first, the refresh operation silently fails with no error.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor

@christopherferreira9 christopherferreira9 left a comment

Choose a reason for hiding this comment

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

Looks good for QA!

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

await MobileBrowserScreen.tapUrlBar();
await AppwrightGestures.typeText(await MobileBrowserScreen.chromeUrlBar, url);
await MobileBrowserScreen.tapSelectDappUrl(dappName);
await MobileBrowserScreen.tapSelectDappUrl();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unused dappName parameter in navigation functions

Low Severity

The dappName parameter is declared in navigateToDappAndroid and navigateToDapp but never used. The implementation was changed to use chromeUrlEntry element instead of searching by dapp name text, but the parameter was not removed from the function signatures. Callers still pass dappName values that are silently ignored.

Additional Locations (1)

Fix in Cursor Fix in Web

@jiexi jiexi moved this to Needs dev review in PR review queue Jan 22, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

This PR contains changes exclusively to the appwright and wdio test frameworks, which are separate from the Detox E2E testing framework. The changes include:

  1. appwright test specs: New and modified connection tests (connection-evm.spec.js, connection-multichain.spec.js, connection-wagmi.spec.js)
  2. wdio screen objects: New screen objects for test dapps (MultiChainEvmTestDapp.js, WagmiTestDapp.js) and modals (SignModal.js, SwitchChainModal.js, AddChainModal.js)
  3. tests/framework utilities: AppwrightHelpers.ts (new), AppwrightGestures.ts, AppwrightSelectors.ts - these are specifically for appwright (using appwright's Device type)
  4. package.json: Adding appwright-related dependencies (appium-adb, appium-chromium-driver, @playwright/test resolution)
  5. Configuration files: .depcheckrc.yml, yarn.lock, ios/Podfile.lock, appwright patches

Critically, there are NO changes to:

  • Application source code (app/ directory)
  • Detox test specs (e2e/specs/)
  • Detox page objects or utilities
  • Core app components, controllers, or engine

Per the guidance: "Changes to wdio/ or appwright/ directories (separate test frameworks) do not require Detox tags - select none unless app code is also changed." Since all changes are confined to appwright/wdio infrastructure with no app code modifications, no Detox E2E tests need to run.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@christopherferreira9 christopherferreira9 left a comment

Choose a reason for hiding this comment

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

Approving again for QA

Copy link
Copy Markdown
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

LGTM

@github-project-automation github-project-automation bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Jan 23, 2026
@jiexi jiexi added this pull request to the merge queue Jan 23, 2026
Merged via the queue into main with commit e6ee768 Jan 23, 2026
59 of 60 checks passed
@jiexi jiexi deleted the jl/mm-connect-e2e-multichain-test-dapp branch January 23, 2026 22:38
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2026
@metamaskbot metamaskbot added the release-7.65.0 Issue or pull request that will be included in release 7.65.0 label Jan 23, 2026
@metamaskbot metamaskbot added release-7.64.0 Issue or pull request that will be included in release 7.64.0 and removed release-7.65.0 Issue or pull request that will be included in release 7.65.0 labels Feb 3, 2026
@metamaskbot
Copy link
Copy Markdown
Collaborator

Missing release label release-7.64.0 on PR. Adding release label release-7.64.0 on PR and removing other release labels(release-7.65.0), as PR was added to branch 7.64.0 when release was cut.

@metamaskbot
Copy link
Copy Markdown
Collaborator

No release label on PR. Adding release label release-7.64.0 on PR, as PR was added to branch 7.64.0 when release was cut.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.64.0 Issue or pull request that will be included in release 7.64.0 size-XL team-wallet-integrations Wallet Integrations team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

8 participants