Commit 81d6285
fix: flaky ledger e2e tests (#35888)
## **Description**
Fix flaky e2e tests on Ledger flows
[](https://codespaces.new/MetaMask/metamask-extension/pull/35888?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: null
## **Related issues**
Fixes:
## **Manual testing steps**
Local testing
- run `yarn && yarn start:test` in one terminal tab and wait for build
end
- run `yarn test:e2e:single
test/e2e/tests/hardware-wallets/ledger/ledger-swap.spec.ts` on another
terminal tab
Otherwise check this PR CI.
## **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**
- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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]
> Unskips and stabilizes the Ledger ETH→DAI swap e2e by disabling Smart
Transactions, adding a brief delay, updating wait logic, and switching
swap API mocks to bridge endpoints.
>
> - **E2E Tests (Ledger swap)**:
> - Unskips `swaps ETH to DAI` in
`test/e2e/tests/hardware-wallets/ledger/ledger-swap.spec.ts`.
> - Disables Smart Transactions via fixtures
(`withPreferencesControllerSmartTransactionsOptedOut`) and manifest flag
(`testing.disableSmartTransactionsOverride`); removes UI steps to toggle
it.
> - Adds a 5s delay before submitting swap to mitigate re-render
flakiness; minor tab-switch simplification.
> - **Page Object**:
> - `test/e2e/page-objects/pages/swap/swap-page.ts`: replace polling
loop in `swapProcessingMessageCheck` with `waitForSelector` on
`awaiting-swap-header`.
> - **Mocks**:
> - `test/e2e/tests/hardware-wallets/ledger/mocks.ts`: point network
info, feature flags, and tokens endpoints from `swap.api` to
`bridge.api`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
1bba0fb. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: seaona <[email protected]>1 parent af41680 commit 81d6285
File tree
3 files changed
+18
-37
lines changed- test/e2e
- page-objects/pages/swap
- tests/hardware-wallets/ledger
3 files changed
+18
-37
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
180 | 177 | | |
181 | 178 | | |
182 | 179 | | |
| |||
Lines changed: 11 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | | - | |
9 | 6 | | |
10 | | - | |
11 | 7 | | |
12 | | - | |
13 | 8 | | |
14 | 9 | | |
15 | 10 | | |
16 | 11 | | |
17 | 12 | | |
18 | 13 | | |
19 | 14 | | |
20 | | - | |
| 15 | + | |
21 | 16 | | |
22 | 17 | | |
23 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 40 | | |
54 | 41 | | |
55 | 42 | | |
| |||
75 | 62 | | |
76 | 63 | | |
77 | 64 | | |
78 | | - | |
79 | 65 | | |
| 66 | + | |
80 | 67 | | |
| 68 | + | |
| 69 | + | |
81 | 70 | | |
82 | | - | |
83 | 71 | | |
84 | 72 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | 73 | | |
90 | 74 | | |
91 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
| 315 | + | |
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
0 commit comments