-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: version v12.1.0 cherry pick 90d89 (#25701)
<!-- 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** Cherry pick PR for the fix #25601 <!-- 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/25701?quickstart=1) ## **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/develop/.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/develop/.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.
- Loading branch information
Showing
10 changed files
with
161 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { strict as assert } from 'assert'; | ||
import { Context } from 'mocha'; | ||
import { CHAIN_IDS } from '../../../../shared/constants/network'; | ||
import FixtureBuilder from '../../fixture-builder'; | ||
import { | ||
defaultGanacheOptions, | ||
openActionMenuAndStartSendFlow, | ||
unlockWallet, | ||
withFixtures, | ||
} from '../../helpers'; | ||
import { Driver } from '../../webdriver/driver'; | ||
import { RECIPIENT_ADDRESS_MOCK } from '../simulation-details/types'; | ||
|
||
describe('AssetPickerSendFlow', function () { | ||
const chainId = CHAIN_IDS.MAINNET; | ||
|
||
const fixtures = { | ||
fixtures: new FixtureBuilder({ inputChainId: chainId }).build(), | ||
ganacheOptions: { | ||
...defaultGanacheOptions, | ||
chainId: parseInt(chainId, 16), | ||
}, | ||
}; | ||
|
||
it('should send token using asset picker modal', async function () { | ||
const ethConversionInUsd = 10000; | ||
|
||
await withFixtures( | ||
{ | ||
...fixtures, | ||
title: (this as Context).test?.fullTitle(), | ||
ethConversionInUsd, | ||
}, | ||
async ({ driver }: { driver: Driver }) => { | ||
await unlockWallet(driver); | ||
|
||
// Open the send flow | ||
openActionMenuAndStartSendFlow(driver); | ||
|
||
await driver.fill('[data-testid="ens-input"]', RECIPIENT_ADDRESS_MOCK); | ||
await driver.fill('.unit-input__input', '2'); | ||
|
||
const isDest = 'dest'; | ||
const buttons = await driver.findElements( | ||
'[data-testid="asset-picker-button"]', | ||
); | ||
const indexOfButtonToClick = isDest ? 1 : 0; | ||
await buttons[indexOfButtonToClick].click(); | ||
|
||
// check that the name , crypto amount and fiat amount are correctly displayed | ||
const tokenListName = await ( | ||
await driver.findElement( | ||
'[data-testid="multichain-token-list-item-token-name"]', | ||
) | ||
).getText(); | ||
|
||
assert.equal(tokenListName, 'Ethereum'); | ||
|
||
const tokenListValue = await ( | ||
await driver.findElement( | ||
'[data-testid="multichain-token-list-item-value"]', | ||
) | ||
).getText(); | ||
|
||
assert.equal(tokenListValue, '25 ETH'); | ||
|
||
const tokenListSecondaryValue = await ( | ||
await driver.findElement( | ||
'[data-testid="multichain-token-list-item-secondary-value"]', | ||
) | ||
).getText(); | ||
|
||
assert.equal(tokenListSecondaryValue, '$250,000.00'); | ||
|
||
// Search for BNB | ||
const searchInputField = await driver.waitForSelector( | ||
'[data-testid="asset-picker-modal-search-input"]', | ||
); | ||
await searchInputField.sendKeys('CHZ'); | ||
|
||
// check that BNB is disabled | ||
const [, tkn] = await driver.findElements( | ||
'[data-testid="multichain-token-list-button"]', | ||
); | ||
|
||
await tkn.click(); | ||
const isSelected = await tkn.isSelected(); | ||
assert.equal(isSelected, false); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters