You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: Fix flask multichain api wallet_invokeMethod e2e tests (#37471)
## **Description**
Fix these 2 flaky tests:
- Multichain API Calling `wallet_invokeMethod` on the same dapp across
three different connected chains Write operations: calling
`eth_sendTransaction` on each connected scope should have less balance
due to gas after transaction is sent
- Multichain API Calling `wallet_invokeMethod` on the same dapp across
three different connected chains Write operations: calling
`eth_sendTransaction` on each connected scope should match chosen
addresses in each chain to the selected address per scope in extension
window
The 2 flaky tests share same reason of flakiness: as we invoke all
methods the same time, so the confirmation screen order is not always
the same when we run test, so the displayed order of account and network
can be different
https://github.com/user-attachments/assets/5d5a2104-1dea-4315-83d9-02d787ccf602
The test was flaky because it assumed a fixed order of confirmation
screens. The new logic no longer depends on a strict order. Instead, it:
- Iterates through each confirmation screen dynamically.
- Collects the displayed account name and/or network name for each
confirmation.
- Verifies that all expected combinations appear, regardless of order.
[](https://codespaces.new/MetaMask/metamask-extension/pull/31396?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**
## **Manual testing steps**
Tests should pass and be robust
## **Screenshots/Recordings**
### **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**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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]
> Makes multichain wallet_invokeMethod e2e tests order-agnostic,
enhances confirmation page object APIs, and adds a data-testid to the
network name used by tests.
>
> - **E2E (Multichain `wallet_invokeMethod`)**:
> - Refactor write-ops tests to be order-agnostic: dynamically iterate
confirmations, collect `account`/`network`, and assert all expected
combinations; validate unique/expected networks across dialogs.
> - Add `SCOPE_TO_NETWORK_NAME` map; update balance checks to verify
post-gas changes per network.
> - **Page Object (`TransactionConfirmation`)**:
> - Add selectors for header account and network name
(`confirmation__details-network-name`).
> - New helpers: `getNetworkName`, `getSenderAccountName`,
`checkNetworkIsNotDisplayed`, `checkHeaderAccountNameIsDisplayed`;
rename `checkIsSenderAccountDisplayed` →
`checkSenderAccountIsDisplayed`.
> - **Metrics Test**:
> - Switch to `checkHeaderAccountNameIsDisplayed('Account 1')` before
advanced details.
> - **UI (Confirm Info Network Row)**:
> - Add `data-testid="confirmation__details-network-name"` to network
name; update related snapshots.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
a246399. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Copy file name to clipboardExpand all lines: ui/pages/confirmations/components/confirm/info/native-transfer/__snapshots__/native-transfer.test.tsx.snap
Copy file name to clipboardExpand all lines: ui/pages/confirmations/components/confirm/info/nft-token-transfer/__snapshots__/nft-token-transfer.test.tsx.snap
Copy file name to clipboardExpand all lines: ui/pages/confirmations/components/confirm/info/token-transfer/__snapshots__/token-details-section.test.tsx.snap
0 commit comments