Skip to content

test: Fix SmokeTrade E2E tests#29523

Merged
chrisleewilcox merged 10 commits into
mainfrom
fix/swap-deeplink-tests
Apr 30, 2026
Merged

test: Fix SmokeTrade E2E tests#29523
chrisleewilcox merged 10 commits into
mainfrom
fix/swap-deeplink-tests

Conversation

@davibroc

@davibroc davibroc commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR should fix the following SmokeTrade tests:

SmokeTrade: Swap from Actions swaps ETH->USDC with custom slippage and USDC->ETH (failed 1 time, 0 retries) - last log

SmokeTrade: Swap Deep Link Tests - Unified Bridge Experience navigate to bridge view with full parameters (USDC to USDT) (failed 1 time, 0 retries) - last log

SmokeTrade: Gasless Swap - completes a gasless 7702 ETH to MUSD swap (native source) (failed 1 time, 0 retries) - last log

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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
Test-only changes that adjust Detox app launching behavior and add additional HTTP mocks; low risk to production code, with minor risk of masking real integration issues if mock matching is too broad.

Overview
Stabilizes swap deeplink smoke tests on iOS by adding a short post-sendToHome() delay and launching deeplinks with newInstance: false to ensure URLs are delivered to the existing app instance.

Expands swap E2E mocking by introducing reusable setupSwapSocialAndComplianceMocks() to stub the Social leaderboard and compliance batch endpoints, wiring it into swap and trending-token smoke setups. Also tightens the swap proxy URL interception so the insufficientBal rewrite only targets JSON getQuote requests (not getQuoteStream).

Reviewed by Cursor Bugbot for commit edbfe2c. Bugbot is set up for automated code reviews on this repo. 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.

@davibroc davibroc added team-qa QA team no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels Apr 29, 2026
Comment thread tests/smoke/swap/swap-deeplink-smoke.spec.ts Outdated
@davibroc davibroc force-pushed the fix/swap-deeplink-tests branch from 7decf0f to 8875385 Compare April 29, 2026 21:19
@github-actions github-actions Bot added size-S and removed size-XS labels Apr 29, 2026
Comment thread tests/smoke/swap/swap-deeplink-smoke.spec.ts Outdated
Comment thread tests/smoke/swap/swap-deeplink-smoke.spec.ts Outdated

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

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 3533884. Configure here.

Comment thread tests/smoke/swap/swap-deeplink-smoke.spec.ts Outdated
@davibroc davibroc changed the title test(smoke): stabilize swap deeplink smoke after sendToHome on iOS test: stabilize swap deeplink smoke after sendToHome on iOS Apr 30, 2026
@davibroc davibroc force-pushed the fix/swap-deeplink-tests branch 3 times, most recently from b5784c3 to b3e444c Compare April 30, 2026 20:47
@davibroc davibroc force-pushed the fix/swap-deeplink-tests branch from b3e444c to e345f63 Compare April 30, 2026 21:18
await loginToApp();
await device.sendToHome();
// intentional: Detox iOS 16+ sendToHome briefly opens Settings; wait before launchApp({ url }).
if (device.getPlatform() === 'ios') await TestHelpers.delay(1000);

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.

According to AI , device.sendToHome() with iOS < 16 goes straight to the home screen. However as you see in the video on iOS 16+ Detox briefly open and close Settings in order to push the app to the background. AI suggest that the only way is to wait to allow app to go to the background. Unfortunately Detox does not reliably see the iOS Settings page so there's not a way to wait until it disappears.

test.mp4

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSwap, SmokeConfirmations, SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 4 changed files are E2E test files within the swap test suite:

  1. tests/helpers/swap/swap-mocks.ts: Adds setupSwapSocialAndComplianceMocks() to mock social leaderboard and compliance batch APIs. Also fixes a URL matching bug (excluding getQuoteStream from insufficientBal intercept). This helper is used by swap and bridge specs.

  2. tests/helpers/swap/swap-unified-ui.ts: Minor instrumentation - adds a logger and timing debug log for quote visibility. No functional change.

  3. tests/smoke/swap/swap-deeplink-smoke.spec.ts (SmokeSwap): Fixes iOS 16+ deep link handling by adding a 1-second delay after sendToHome and using newInstance: false. This is a bug fix for flaky iOS deep link tests.

  4. tests/smoke/swap/swap-trending-tokens.spec.ts (SmokeSwap): Adds setupSwapSocialAndComplianceMocks to the trending tokens mock setup to prevent unhandled API calls from causing test failures.

Tag selection rationale:

  • SmokeSwap: Directly affected - all files are swap test infrastructure. The mock fixes and deep link fixes need validation.
  • SmokeConfirmations: Required by SmokeSwap tag description ("when selecting SmokeSwap, also select SmokeConfirmations").
  • SmokeWalletPlatform: The swap-trending-tokens.spec.ts touches the Trending tab's token display, which is part of SmokeWalletPlatform. The social leaderboard mock is also relevant to Trending content.

No app source code was changed, so no broader impact on other test areas.

Performance Test Selection:
All changes are confined to E2E test files (test helpers and smoke specs). No app source code, UI components, controllers, or data-loading logic was modified. There is no performance impact to measure.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@chrisleewilcox chrisleewilcox added this pull request to the merge queue Apr 30, 2026
Merged via the queue into main with commit 8d4e444 Apr 30, 2026
103 checks passed
@chrisleewilcox chrisleewilcox deleted the fix/swap-deeplink-tests branch April 30, 2026 22:54
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.77.0 Issue or pull request that will be included in release 7.77.0 label Apr 30, 2026
@davibroc davibroc changed the title test: stabilize swap deeplink smoke after sendToHome on iOS test: Fix SmokeTrade E2E tests May 1, 2026
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.77.0 Issue or pull request that will be included in release 7.77.0 size-S team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants