Skip to content

fix: wait for input value and fetch calls during unit test execution (swaps)#39747

Merged
gambinish merged 3 commits intomainfrom
swaps-fix-flaky-input-test
Feb 3, 2026
Merged

fix: wait for input value and fetch calls during unit test execution (swaps)#39747
gambinish merged 3 commits intomainfrom
swaps-fix-flaky-input-test

Conversation

@micaelae
Copy link
Member

@micaelae micaelae commented Feb 3, 2026

Description

Addressing bridge-input-group unit test flakiness

Open in GitHub Codespaces

Changelog

CHANGELOG entry: fix: wait for input value and fetch calls during unit test execution (swaps)

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

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

Low Risk
Low risk because changes are limited to test timing/assertions; primary risk is masking a real regression by relaxing an abort-call assertion.

Overview
Reduces flakiness in bridge-input-group.test.tsx by making fillSearchInput wait until the search field reflects the expected value (including cases where the UI transforms input, e.g. SDUSD).

Updates the network-picker test to assert handleFetch call counts within the waitFor block and removes the brittle expectation of the exact AbortController.abort call arguments/order.

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

@metamaskbot metamaskbot added the team-swaps-and-bridge Swaps and Bridge team label Feb 3, 2026
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 3, 2026

✨ Files requiring CODEOWNER review ✨

🔄 @MetaMask/swaps-engineers (1 files, +8 -13)
  • 📁 ui/
    • 📁 pages/
      • 📁 bridge/
        • 📁 prepare/
          • 📄 bridge-input-group.test.tsx +8 -13

@micaelae micaelae changed the title fix: wait for search query field to be filled during unit test execution fix: wait for input value and fetch calls during unit test execution (swaps) Feb 3, 2026
@github-actions github-actions bot added size-S and removed size-XS labels Feb 3, 2026
@micaelae micaelae marked this pull request as ready for review February 3, 2026 17:54
@micaelae micaelae requested a review from a team as a code owner February 3, 2026 17:54
@metamaskbotv2
Copy link
Contributor

metamaskbotv2 bot commented Feb 3, 2026

Builds ready [8d0cfe1]
UI Startup Metrics (1356 ± 102 ms)
PlatformBuildTypePageMetricTest Title (ms)Persona (ms)Mean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--13561135163510214281539
load--1162950143110212231328
domContentLoaded--1156943142210212171321
domInteractive--241593162275
firstPaint--164631268126195279
backgroundConnect--22420027213229258
firstReactRender--1793452026
initialActions--108114
loadScripts--947739121110210071105
setupStore--1463151723
numNetworkReqs--221581181576
19--------
BrowserifyPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--22141613762179022334130
load--11721029191115412231520
domContentLoaded--11551016189415011911499
domInteractive--3518138243397
firstPaint--1837343590246379
backgroundConnect--40228517402713531152
firstReactRender--24154672740
initialActions--105112
loadScripts--91378515681339581215
setupStore--1665271832
numNetworkReqs--1005221241116197
19--------
WebpackStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--83766611121129251067
load--706585103598772899
domContentLoaded--701582103097767893
domInteractive--241586172178
firstPaint--1055836058111232
backgroundConnect--3417133193875
firstReactRender--15103141725
initialActions--104112
loadScripts--698580102896765891
setupStore--1163041222
numNetworkReqs--221588181576
19--------
WebpackPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--1255897188923014671643
load--7096071064104713994
domContentLoaded--6986021055104701987
domInteractive--37181702936108
firstPaint--15367950115173437
backgroundConnect--16012935548155306
firstReactRender--22163442430
initialActions--104111
loadScripts--6966001047102699978
setupStore--1243541418
numNetworkReqs--1424934960168265
19--------
FirefoxBrowserifyStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--16961335255322418202244
load--14291164213018915071796
domContentLoaded--14271164213018915071796
domInteractive--813418838101141
firstPaint--------
backgroundConnect--862325754136201
firstReactRender--12104331316
initialActions--103112
loadScripts--13791142209017014491680
setupStore--1851752912105
numNetworkReqs--221286171776
19--------
BrowserifyPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--29522213515455030654100
load--15481204268532615722514
domContentLoaded--15471204268532615712513
domInteractive--1233554196133340
firstPaint--------
backgroundConnect--3031191370245318882
firstReactRender--18147661923
initialActions--213122
loadScripts--15011179253729415432377
setupStore--1117679163111511
numNetworkReqs--79382284491205
19--------
WebpackStandard Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--15891353238916016891891
load--13801189216013014351593
domContentLoaded--13801185216013014341593
domInteractive--772816838106141
firstPaint--------
backgroundConnect--62241943978142
firstReactRender--14114141421
initialActions--103112
loadScripts--13461174213712014021502
setupStore--185240351164
numNetworkReqs--221285161974
19--------
WebpackPower User Home0--------
1--------
2--------
3--------
4--------
5--------
6--------
7--------
8--------
9--------
10--------
11--------
12--------
13--------
14--------
15--------
16--------
17--------
18--------
uiStartup--29322198466851230593989
load--15981273273932517092324
domContentLoaded--15981273273932517082324
domInteractive--11735652102117333
firstPaint--------
backgroundConnect--2981141381266293877
firstReactRender--22156982332
initialActions--207123
loadScripts--15421253259328016582249
setupStore--1718905220269632
numNetworkReqs--75382094483183
19--------
📊 Page Load Benchmark Results

Current Commit: 8d0cfe1 | Date: 2/3/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±105ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 724ms (±124ms) 🟢 | historical mean value: 723ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 94ms (±192ms) 🟢 | historical mean value: 78ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 105ms 1.00s 2.05s 1.05s 2.05s
domContentLoaded 724ms 124ms 693ms 1.93s 733ms 1.93s
firstPaint 94ms 192ms 60ms 2.00s 84ms 2.00s
firstContentfulPaint 94ms 192ms 60ms 2.00s 84ms 2.00s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 0 Bytes (0%)
  • common: 1.04 KiB (0.01%)

@micaelae micaelae enabled auto-merge February 3, 2026 18:29
@micaelae micaelae added this pull request to the merge queue Feb 3, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 3, 2026
@gambinish gambinish added this pull request to the merge queue Feb 3, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 3, 2026
…(swaps) (#39747)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Addressing bridge-input-group unit test flakiness

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/39747?quickstart=1)

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: fix: wait for input value and fetch calls during unit
test execution (swaps)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Low risk because changes are limited to test timing/assertions;
primary risk is masking a real regression by relaxing an abort-call
assertion.
> 
> **Overview**
> Reduces flakiness in `bridge-input-group.test.tsx` by making
`fillSearchInput` wait until the search field reflects the expected
value (including cases where the UI transforms input, e.g. `SD` →
`USD`).
> 
> Updates the network-picker test to assert `handleFetch` call counts
within the `waitFor` block and removes the brittle expectation of the
exact `AbortController.abort` call arguments/order.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
8d0cfe1. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Merged via the queue into main with commit 6120bbc Feb 3, 2026
92 of 94 checks passed
@gambinish gambinish deleted the swaps-fix-flaky-input-test branch February 3, 2026 22:15
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2026
@metamaskbot metamaskbot added the release-13.18.0 Issue or pull request that will be included in release 13.18.0 label Feb 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.18.0 Issue or pull request that will be included in release 13.18.0 size-S team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants