-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add Send eth with a Trezor account spec (#26530)
<!-- 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** This PR adds a new spec for sending ETH using a Trezor account. This is based on @mikesposito 's [work for unlocking Trezor accounts](https://github.com/MetaMask/metamask-extension/pull/25824/files#diff-68eb44d9a0523c834e912eda6dcec0d84faed3ef31c86bccadbf86bd64a54f44) and it's a joined work with @mikesposito which helped in the investigation of several blockers. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26530?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#3015 ## **Manual testing steps** 1. Check ci 2. Alternatively, run the test locally `yarn test:e2e:single test/e2e/tests/hardware-wallets/trezor-send.spec.ts --browser=chrome` ## **Screenshots/Recordings** https://github.com/user-attachments/assets/06ce6ae8-6296-4683-953d-50df0c84db9d ## **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/develop/.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/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. --------- Co-authored-by: Michele Esposito <[email protected]> Co-authored-by: Michele Esposito <[email protected]>
- Loading branch information
1 parent
838ad26
commit 416d024
Showing
6 changed files
with
331 additions
and
7 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
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
File renamed without changes.
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,47 @@ | ||
import { Suite } from 'mocha'; | ||
import { Driver } from '../../webdriver/driver'; | ||
import { Ganache } from '../../seeder/ganache'; | ||
import FixtureBuilder from '../../fixture-builder'; | ||
import { | ||
defaultGanacheOptions, | ||
logInWithBalanceValidation, | ||
sendTransaction, | ||
withFixtures, | ||
} from '../../helpers'; | ||
import { KNOWN_PUBLIC_KEY_ADDRESSES } from '../../../stub/keyring-bridge'; | ||
|
||
const RECIPIENT = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3'; | ||
|
||
describe('Trezor Hardware', function (this: Suite) { | ||
it('send ETH', async function () { | ||
await withFixtures( | ||
{ | ||
fixtures: new FixtureBuilder().withTrezorAccount().build(), | ||
ganacheOptions: defaultGanacheOptions, | ||
title: this.test?.fullTitle(), | ||
}, | ||
async ({ | ||
driver, | ||
ganacheServer, | ||
}: { | ||
driver: Driver; | ||
ganacheServer?: Ganache; | ||
}) => { | ||
// Seed the Trezor account with balance | ||
await ganacheServer?.setAccountBalance( | ||
KNOWN_PUBLIC_KEY_ADDRESSES[0].address, | ||
'0x100000000000000000000', | ||
); | ||
await logInWithBalanceValidation(driver); | ||
|
||
await sendTransaction(driver, RECIPIENT, '1'); | ||
|
||
// Wait for transaction to be confirmed | ||
await driver.waitForSelector({ | ||
css: '.transaction-status-label', | ||
text: 'Confirmed', | ||
}); | ||
}, | ||
); | ||
}); | ||
}); |
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
Oops, something went wrong.