MetaMask / MetaMask/metamask-mobile

Enable Integration Testing Capabilities on the Mobile Platform

Open
#19,776 0 comments 0 reactions 0 assignees View on GitHub
team-mobile-platform
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

### What is this about?

As a developer, I would like to the capabilities to create UI integration tests similar to the extension. An engineer has attempted to start this work in [this diff](https://github.com/MetaMask/metamask-mobile/compare/main...test/init-integration-tests).

📋 Integration Testing Infrastructure:

- Uses React Native Testing Library for component rendering
- Mock Service Worker (MSW) for API mocking capabilities
- Jest configured for React Native integration tests
- Mock setup for React Native modules (WebView, Clipboard, AsyncStorage, etc.)

🏗️ Testable Architecture:

- Extracted ConnectedRoot component for easier testing
- Async store initialization with createStoreAndPersistor()
- Support for preloaded Redux state in tests
- Proper separation of concerns for test vs production code

🧪 Example Test Pattern:

- Uses fixture builders from existing e2e tests
- Snapshot testing for component rendering
- Async rendering with proper loading states

🔧 Development Tools:

- New npm script: yarn test:integration
- Platform-specific testing (iOS/Android)
- Coverage reporting for integration tests
- Proper mock configurations for MetaMask-specific modules

### Scenario

_No response_

### Design

_No response_

### Technical Details

_No response_

### Threat Modeling Framework

_No response_

### Acceptance Criteria

_No response_

### Stakeholder review needed before the work gets merged

- [x] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the referenced integration-test diff and review the existing e2e fixture builders. Check the proposed `yarn test:integration` command and its platform-specific behavior on iOS and Android. Done means the mobile project supports the listed React Native integration-test infrastructure, mocking, preloaded state, coverage, and example test pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.