chore: adds call redirect from iab to mockServer#25652
chore: adds call redirect from iab to mockServer#25652christopherferreira9 wants to merge 2 commits intomainfrom
Conversation
|
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The BrowserTab component is the core WebView component used for all browser-based interactions in the app, including:
Since this modifies E2E testing infrastructure that affects how the browser/WebView works during tests, I'm selecting tags for tests that use browser functionality:
The changes are guarded by Performance Test Selection: |
Description
Enable E2E mock server interception for the in-app browser (WebView). Previously, API calls made from websites loaded in the WebView were not being intercepted by the mock server during E2E tests, causing tests to hit live endpoints.
Problem
The existing mock server implementation patches fetch and XMLHttpRequest in the React Native JavaScript context (shim.js). However, the WebView runs in a separate browser context with its own network stack, so these patches don't affect WebView requests.
Solution
This PR adds two complementary interception mechanisms for the WebView:
Changes
app/core/EntryScriptProxyE2E.ts(New File)app/components/Views/BrowserTab/BrowserTab.tsxtests/api-mocking/MockServerE2E.tsscripts/build.sh
Example
With this change we can now see live calls being catch on the mock server coming from the IAB.
Dependencies
This PR requires an updated version of @metamask/react-native-webview with native E2E interception support. See: MetaMask/react-native-webview-mm#78
Changelog
CHANGELOG entry: Added the ability to intercept calls coming from the inapp browser on E2E
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist