Skip to content

test: add browser navigation E2E tests with local fixtures (MMQA-1721)#28894

Merged
chrisleewilcox merged 14 commits into
mainfrom
MMQA-1721-browser-navigation-tests
Apr 17, 2026
Merged

test: add browser navigation E2E tests with local fixtures (MMQA-1721)#28894
chrisleewilcox merged 14 commits into
mainfrom
MMQA-1721-browser-navigation-tests

Conversation

@chrisleewilcox
Copy link
Copy Markdown
Contributor

@chrisleewilcox chrisleewilcox commented Apr 16, 2026

Description

Add browser navigation E2E tests with local fixtures to replace quarantined tests from browser-tests.failing.ts. Three tests cover:

  1. Invalid URL — navigates to a non-existent URL and verifies the browser returns home
  2. ENS resolution — resolves vitalik.eth via mocked ENS/IPFS and verifies the fixture page loads
  3. Cross-origin redirect (it.skip) — loads a redirect page on one dapp server that navigates to a second dapp server, verifying the URL bar updates. Skipped due to an app-level bug where BrowserTab.handleSuccessfulPageResolution does not update the URL bar after JS-initiated cross-origin redirects (MCWP-540).

Part of the browser tests migration effort (MMQA-1368) to move quarantined E2E tests from external URLs to local HTML fixtures with API mocking.

Changelog

CHANGELOG entry: null

Related issues

Fixes: MMQA-1721
Related app bug: MCWP-540

Manual testing steps

Feature: Browser Navigation

  Scenario: user visits an invalid URL and returns home
    Given the user is logged in and on the browser tab

    When user navigates to an invalid URL (https://quackquakc.easq)
    And user taps the Return Home button
    Then the URL bar no longer shows the invalid URL origin

  Scenario: user resolves an ENS domain
    Given the user is logged in and on the browser tab
    And ENS resolution is mocked to return a local fixture via IPFS gateway

    When user navigates to vitalik.eth
    Then the ENS fixture page loads with a General link

  Scenario: user follows a cross-origin redirect (skipped)
    Given the user is logged in and on the browser tab
    And two local dapp servers are running with redirect fixtures

    When user navigates to a redirect page on dapp server 1
    Then the URL bar shows the origin of dapp server 1

    When the page redirects to dapp server 2
    Then the URL bar shows the origin of dapp server 2
    # Skipped: app bug MCWP-540 — URL bar does not update after JS cross-origin redirect

Screenshots/Recordings

Before

N/A — new tests, no prior implementation

After

Android (Pixel 9)

PASS tests/smoke/wallet/browser/browser-navigation.spec.ts (267.195 s)
  SmokeWalletPlatform: Browser Navigation
    ✓ navigates back home after visiting an invalid URL (92816 ms)
    ✓ resolves and displays ENS website (vitalik.eth) (76344 ms)
    ○ skipped: displays redirected URL after cross-origin redirect

Test Suites: 1 passed, 1 total
Tests:       1 skipped, 2 passed, 3 total

iOS (iPhone 16 Pro)

PASS tests/smoke/wallet/browser/browser-navigation.spec.ts (260.222 s)
  SmokeWalletPlatform: Browser Navigation
    ✓ navigates back home after visiting an invalid URL (102674 ms)
    ✓ resolves and displays ENS website (vitalik.eth) (71537 ms)
    ○ skipped: displays redirected URL after cross-origin redirect

Test Suites: 1 passed, 1 total
Tests:       1 skipped, 2 passed, 3 total

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.

chrisleewilcox and others added 5 commits April 15, 2026 19:29
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… tests (MMQA-1721)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…test

- Use CIDv0 (QmRAQB6...) for IPFS path matching since that's what
  contentHash.decode() returns
- Override ipfsGateway in PreferencesController to point at mock server
  so WebView loads fixture HTML instead of real dweb.link
- Add dual mock rules: proxy-routed fetch() and direct WebView requests
- Add testSpecificMock for unmocked HyperLiquid/invalid URL requests
- Use runScript for redirect test since Detox WebView tap() doesn't
  reliably fire JS click handlers on <button> elements
- Use addEventListener instead of inline onclick in redirect fixture

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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-qa QA team label Apr 16, 2026
chrisleewilcox and others added 2 commits April 16, 2026 10:10
…A-1721)

Replace prohibited TestHelpers.delay(5000) with Utilities.executeWithRetry
for waiting on ENS page load.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mes (MMQA-1721)

Move WebView runScript redirect logic into RedirectWebsite.navigateToTargetUrl()
page object method. Rename all test names to drop prohibited 'should' prefix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chrisleewilcox chrisleewilcox added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed no changelog required No changelog entry is required for this change labels Apr 16, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chrisleewilcox chrisleewilcox marked this pull request as ready for review April 16, 2026 17:50
@chrisleewilcox chrisleewilcox requested a review from a team as a code owner April 16, 2026 17:50
Comment thread tests/page-objects/Browser/ExternalWebsites/RedirectWebsite.ts Outdated
@github-actions github-actions Bot added the risk-low Low testing needed · Low bug introduction risk label Apr 16, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.20%. Comparing base (37b1dcf) to head (29456c5).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28894      +/-   ##
==========================================
+ Coverage   82.19%   82.20%   +0.01%     
==========================================
  Files        5043     5044       +1     
  Lines      132426   132548     +122     
  Branches    29571    29603      +32     
==========================================
+ Hits       108848   108962     +114     
- Misses      16172    16183      +11     
+ Partials     7406     7403       -3     

☔ 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.

… (MMQA-1721)

The runScript/cssSelector approach fails on CI release builds because the
browser-webview view isn't recognized as a WebView with JS enabled.
Switch to tapRedirectButton which uses XPath tap — same pattern that
works for the ENS test on CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 16, 2026
Comment thread tests/fixtures/ens/index.html Outdated
…721)

After an in-page redirect the URL bar TextInput is hidden (unfocused,
opacity 0) so Detox's toHaveText matcher cannot match it. Tap the URL
bar first to make it visible, and assert the full resolved URL instead
of just the origin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 16, 2026
…-1721)

The URL bar TextInput is hidden (opacity 0) when unfocused, so Detox
toHaveText cannot match it after an in-page redirect. Focusing the bar
races with the redirect completion. Instead, use waitFor + by.text to
check the visible Text component that shows the origin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 16, 2026
Copy link
Copy Markdown
Contributor

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

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 29456c5. Configure here.

Comment thread tests/smoke/wallet/browser/browser-navigation.spec.ts Outdated
…tion (MMQA-1721)

BrowserTab.handleSuccessfulPageResolution only updates the URL bar when
onLoadEnd's "started && ended" condition is met. For JS-initiated
cross-origin redirects this condition is not reliably satisfied, leaving
the URL bar stale. This was the original reason the test was quarantined.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 16, 2026
The HTML content is already inlined as ENS_INDEX_HTML and ENS_GENERAL_HTML
constants in ens-resolution-mocks.ts, making these on-disk files dead code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:
All 4 changed files are purely test infrastructure additions with no app code changes:

  1. browser-navigation.spec.ts - New E2E test file explicitly tagged with SmokeWalletPlatform (imported from tags.js and used in describe(SmokeWalletPlatform('Browser Navigation'), ...)). Tests browser navigation: invalid URL handling, ENS resolution (vitalik.eth), and cross-origin redirects (skipped test).

  2. ens-resolution-mocks.ts - New mock infrastructure for ENS resolution, intercepting eth_call RPC requests to ENS Registry and Resolver contracts, plus IPFS gateway mocking. Used by the new browser-navigation spec.

  3. redirect.html / redirect-target.html - New HTML fixture files for the redirect test scenario (which is currently skipped in the spec).

Since the new spec file is tagged SmokeWalletPlatform, running that tag will execute the new tests and validate they work correctly. No other tags are needed as no other test areas are affected. No app code was changed, so no regression risk to other test suites.

Performance Test Selection:
All changes are purely test infrastructure (new E2E spec, mock responses, HTML fixtures). No app code was modified, so there is no performance impact to measure.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
12 value mismatches detected (expected — fixture represents an existing user).
View details

@chrisleewilcox chrisleewilcox added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit a624ad5 Apr 17, 2026
107 checks passed
@chrisleewilcox chrisleewilcox deleted the MMQA-1721-browser-navigation-tests branch April 17, 2026 04:38
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no changelog required No changelog entry is required for this change no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed risk-low Low testing needed · Low bug introduction risk size-M team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants