mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
feature(19463): fix send-eth flaky test and refactor (#19531)
This commit is contained in:
parent
8eff1fc1ff
commit
95d57b254f
@ -546,6 +546,12 @@ async function waitForAccountRendered(driver) {
|
||||
);
|
||||
}
|
||||
|
||||
const logInWithBalanceValidation = async (driver, ganacheServer) => {
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
await assertAccountBalanceForDOM(driver, ganacheServer);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
DAPP_URL,
|
||||
DAPP_ONE_URL,
|
||||
@ -573,6 +579,7 @@ module.exports = {
|
||||
defaultGanacheOptions,
|
||||
sendTransaction,
|
||||
findAnotherAccountFromAccountList,
|
||||
logInWithBalanceValidation,
|
||||
assertAccountBalanceForDOM,
|
||||
locateAccountBalanceDOM,
|
||||
restartServiceWorker,
|
||||
|
@ -2,7 +2,7 @@ const { strict: assert } = require('assert');
|
||||
const {
|
||||
convertToHexValue,
|
||||
withFixtures,
|
||||
assertAccountBalanceForDOM,
|
||||
logInWithBalanceValidation,
|
||||
} = require('../helpers');
|
||||
const FixtureBuilder = require('../fixture-builder');
|
||||
|
||||
@ -40,10 +40,8 @@ describe('Address Book', function () {
|
||||
},
|
||||
async ({ driver, ganacheServer }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
await logInWithBalanceValidation(driver, ganacheServer);
|
||||
|
||||
await assertAccountBalanceForDOM(driver, ganacheServer);
|
||||
await driver.clickElement('[data-testid="eth-overview-send"]');
|
||||
const recipientRowTitle = await driver.findElement(
|
||||
'.send__select-recipient-wrapper__group-item__title',
|
||||
|
@ -203,7 +203,6 @@ describe('MetaMask Import UI', function () {
|
||||
// enter private key
|
||||
await driver.findClickableElement('#private-key-box');
|
||||
await driver.fill('#private-key-box', testPrivateKey1);
|
||||
await driver.findClickableElement({ text: 'Import', tag: 'button' });
|
||||
await driver.clickElement({ text: 'Import', tag: 'button' });
|
||||
|
||||
// should show the correct account name
|
||||
|
@ -2,7 +2,7 @@ const { strict: assert } = require('assert');
|
||||
const {
|
||||
convertToHexValue,
|
||||
withFixtures,
|
||||
assertAccountBalanceForDOM,
|
||||
logInWithBalanceValidation,
|
||||
} = require('../helpers');
|
||||
const FixtureBuilder = require('../fixture-builder');
|
||||
|
||||
@ -68,10 +68,7 @@ describe('Gas API fallback', function () {
|
||||
},
|
||||
async ({ driver, ganacheServer }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
await assertAccountBalanceForDOM(driver, ganacheServer);
|
||||
await logInWithBalanceValidation(driver, ganacheServer);
|
||||
await driver.clickElement('[data-testid="eth-overview-send"]');
|
||||
|
||||
await driver.fill(
|
||||
|
@ -5,6 +5,7 @@ const {
|
||||
withFixtures,
|
||||
openDapp,
|
||||
assertAccountBalanceForDOM,
|
||||
logInWithBalanceValidation,
|
||||
} = require('../helpers');
|
||||
const FixtureBuilder = require('../fixture-builder');
|
||||
|
||||
@ -27,10 +28,7 @@ describe('Send ETH from inside MetaMask using default gas', function () {
|
||||
},
|
||||
async ({ driver, ganacheServer }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
await assertAccountBalanceForDOM(driver, ganacheServer);
|
||||
await logInWithBalanceValidation(driver, ganacheServer);
|
||||
|
||||
await driver.clickElement('[data-testid="eth-overview-send"]');
|
||||
|
||||
@ -120,10 +118,7 @@ describe('Send ETH non-contract address with data that matches ERC20 transfer da
|
||||
},
|
||||
async ({ driver, ganacheServer }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
await assertAccountBalanceForDOM(driver, ganacheServer);
|
||||
await logInWithBalanceValidation(driver, ganacheServer);
|
||||
|
||||
await driver.clickElement('[data-testid="eth-overview-send"]');
|
||||
|
||||
|
@ -2,7 +2,7 @@ const { strict: assert } = require('assert');
|
||||
const {
|
||||
convertToHexValue,
|
||||
withFixtures,
|
||||
assertAccountBalanceForDOM,
|
||||
logInWithBalanceValidation,
|
||||
} = require('../helpers');
|
||||
const { SMART_CONTRACTS } = require('../seeder/smart-contracts');
|
||||
const FixtureBuilder = require('../fixture-builder');
|
||||
@ -28,10 +28,9 @@ describe('Send ETH to a 40 character hexadecimal address', function () {
|
||||
title: this.test.title,
|
||||
failOnConsoleError: false,
|
||||
},
|
||||
async ({ driver }) => {
|
||||
async ({ driver, ganacheServer }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
await logInWithBalanceValidation(driver, ganacheServer);
|
||||
|
||||
// Send ETH
|
||||
await driver.clickElement('[data-testid="eth-overview-send"]');
|
||||
@ -135,9 +134,7 @@ describe('Send ERC20 to a 40 character hexadecimal address', function () {
|
||||
},
|
||||
async ({ driver, ganacheServer }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
await assertAccountBalanceForDOM(driver, ganacheServer);
|
||||
await logInWithBalanceValidation(driver, ganacheServer);
|
||||
|
||||
// Send TST
|
||||
await driver.clickElement('[data-testid="home__asset-tab"]');
|
||||
@ -198,10 +195,7 @@ describe('Send ERC20 to a 40 character hexadecimal address', function () {
|
||||
},
|
||||
async ({ driver, ganacheServer }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
await assertAccountBalanceForDOM(driver, ganacheServer);
|
||||
await logInWithBalanceValidation(driver, ganacheServer);
|
||||
|
||||
// Send TST
|
||||
await driver.clickElement('[data-testid="home__asset-tab"]');
|
||||
|
@ -2,7 +2,7 @@ const {
|
||||
convertToHexValue,
|
||||
withFixtures,
|
||||
sendTransaction,
|
||||
assertAccountBalanceForDOM,
|
||||
logInWithBalanceValidation,
|
||||
} = require('../helpers');
|
||||
const FixtureBuilder = require('../fixture-builder');
|
||||
|
||||
@ -25,9 +25,7 @@ describe('Simple send', function () {
|
||||
},
|
||||
async ({ driver, ganacheServer }) => {
|
||||
await driver.navigate();
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
await assertAccountBalanceForDOM(driver, ganacheServer);
|
||||
await logInWithBalanceValidation(driver, ganacheServer);
|
||||
|
||||
await sendTransaction(
|
||||
driver,
|
||||
|
Loading…
Reference in New Issue
Block a user