1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 09:23:21 +01:00

feature(17901): disable hardware wallet test with trezor in mv3 (#19287)

This commit is contained in:
Danica Shen 2023-05-26 14:05:34 +01:00 committed by GitHub
parent 744dfc9e38
commit 7753364958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 65 additions and 106 deletions

View File

@ -505,10 +505,18 @@ const findAnotherAccountFromAccountList = async (
return accountMenuItemSelector;
};
const TEST_SEED_PHRASE =
'forum vessel pink push lonely enact gentle tail admit parrot grunt dress';
const TEST_SEED_PHRASE_TWO =
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent';
module.exports = {
DAPP_URL,
DAPP_ONE_URL,
SERVICE_WORKER_URL,
TEST_SEED_PHRASE,
TEST_SEED_PHRASE_TWO,
getWindowHandles,
convertToHexValue,
tinyDelayMs,

View File

@ -4,6 +4,7 @@ const path = require('path');
const enLocaleMessages = require('../../app/_locales/en/messages.json');
const createStaticServer = require('../../development/create-static-server');
const {
TEST_SEED_PHRASE_TWO,
tinyDelayMs,
regularDelayMs,
largeDelayMs,
@ -21,9 +22,6 @@ describe('MetaMask', function () {
let dappServer;
let tokenAddress;
const testSeedPhrase =
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent';
this.bail(true);
let failed = false;
@ -151,7 +149,7 @@ describe('MetaMask', function () {
await driver.pasteIntoField(
'[data-testid="import-srp__srp-word-0"]',
testSeedPhrase,
TEST_SEED_PHRASE_TWO,
);
await driver.fill('#password', 'correct horse battery staple');

View File

@ -1,5 +1,6 @@
const { strict: assert } = require('assert');
const {
TEST_SEED_PHRASE,
convertToHexValue,
withFixtures,
regularDelayMs,
@ -11,8 +12,6 @@ const enLocaleMessages = require('../../../app/_locales/en/messages.json');
const FixtureBuilder = require('../fixture-builder');
describe('Add account', function () {
const testSeedPhrase =
'forum vessel pink push lonely enact gentle tail admit parrot grunt dress';
const testPassword = 'correct horse battery staple';
const ganacheOptions = {
accounts: [
@ -66,7 +65,7 @@ describe('Add account', function () {
// On boarding with 1st account
await completeImportSRPOnboardingFlow(
driver,
testSeedPhrase,
TEST_SEED_PHRASE,
testPassword,
);
@ -116,7 +115,7 @@ describe('Add account', function () {
await driver.pasteIntoField(
'[data-testid="import-srp__srp-word-0"]',
testSeedPhrase,
TEST_SEED_PHRASE,
);
await driver.fill('#password', 'correct horse battery staple');

View File

@ -1,6 +1,7 @@
const { strict: assert } = require('assert');
const path = require('path');
const {
TEST_SEED_PHRASE,
convertToHexValue,
withFixtures,
regularDelayMs,
@ -11,19 +12,18 @@ const {
} = require('../helpers');
const FixtureBuilder = require('../fixture-builder');
const ganacheOptions = {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
},
],
};
describe('MetaMask Import UI', function () {
it('Importing wallet using Secret Recovery Phrase', async function () {
const ganacheOptions = {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
},
],
};
const testSeedPhrase =
'forum vessel pink push lonely enact gentle tail admit parrot grunt dress';
const testPassword = 'correct horse battery staple';
const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3';
@ -39,7 +39,7 @@ describe('MetaMask Import UI', function () {
await completeImportSRPOnboardingFlow(
driver,
testSeedPhrase,
TEST_SEED_PHRASE,
testPassword,
);
@ -131,17 +131,6 @@ describe('MetaMask Import UI', function () {
});
it('Importing wallet using Secret Recovery Phrase with pasting word by word', async function () {
const ganacheOptions = {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
},
],
};
const testSeedPhrase =
'forum vessel pink push lonely enact gentle tail admit parrot grunt dress';
const testPassword = 'correct horse battery staple';
const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3';
@ -157,7 +146,7 @@ describe('MetaMask Import UI', function () {
await completeImportSRPOnboardingFlowWordByWord(
driver,
testSeedPhrase,
TEST_SEED_PHRASE,
testPassword,
);
@ -178,15 +167,6 @@ describe('MetaMask Import UI', function () {
});
it('Import Account using private key', async function () {
const ganacheOptions = {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
},
],
};
const testPrivateKey1 =
'14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6';
const testPrivateKey2 =
@ -284,16 +264,6 @@ describe('MetaMask Import UI', function () {
});
it('Import Account using json file', async function () {
const ganacheOptions = {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
},
],
};
await withFixtures(
{
fixtures: new FixtureBuilder()
@ -360,15 +330,6 @@ describe('MetaMask Import UI', function () {
it('Import Account using private key of an already active account should result in an error', async function () {
const testPrivateKey =
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9';
const ganacheOptions = {
accounts: [
{
secretKey: testPrivateKey,
balance: convertToHexValue(25000000000000000000),
},
],
};
await withFixtures(
{
fixtures: new FixtureBuilder()
@ -400,44 +361,36 @@ describe('MetaMask Import UI', function () {
);
});
it('Connects to a Hardware wallet', async function () {
const ganacheOptions = {
accounts: [
if (process.env.ENABLE_MV3) {
it('Connects to a Hardware wallet for trezor', async function () {
await withFixtures(
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
fixtures: new FixtureBuilder().build(),
ganacheOptions,
title: this.test.title,
},
],
};
async ({ driver }) => {
await driver.navigate();
await driver.fill('#password', 'correct horse battery staple');
await driver.press('#password', driver.Key.ENTER);
await withFixtures(
{
fixtures: new FixtureBuilder().build(),
ganacheOptions,
title: this.test.title,
},
async ({ driver }) => {
await driver.navigate();
await driver.fill('#password', 'correct horse battery staple');
await driver.press('#password', driver.Key.ENTER);
// choose Connect hardware wallet from the account menu
await driver.clickElement('.account-menu__icon');
await driver.clickElement({
text: 'Connect hardware wallet',
tag: 'div',
});
await driver.delay(regularDelayMs);
// choose Connect hardware wallet from the account menu
await driver.clickElement('.account-menu__icon');
await driver.clickElement({
text: 'Connect hardware wallet',
tag: 'div',
});
await driver.delay(regularDelayMs);
// should open the TREZOR Connect popup
await driver.clickElement('.hw-connect__btn:nth-of-type(2)');
await driver.delay(largeDelayMs * 2);
await driver.clickElement({ text: 'Continue', tag: 'button' });
await driver.waitUntilXWindowHandles(2);
const allWindows = await driver.getAllWindowHandles();
assert.equal(allWindows.length, 2);
},
);
});
// should open the TREZOR Connect popup
await driver.clickElement('.hw-connect__btn:nth-of-type(2)');
await driver.delay(largeDelayMs * 2);
await driver.clickElement({ text: 'Continue', tag: 'button' });
await driver.waitUntilXWindowHandles(2);
const allWindows = await driver.getAllWindowHandles();
assert.equal(allWindows.length, 2);
},
);
});
}
});

View File

@ -1,5 +1,9 @@
const { strict: assert } = require('assert');
const { convertToHexValue, withFixtures } = require('../helpers');
const {
TEST_SEED_PHRASE_TWO,
convertToHexValue,
withFixtures,
} = require('../helpers');
const FixtureBuilder = require('../fixture-builder');
describe('MetaMask Responsive UI', function () {
@ -76,8 +80,6 @@ describe('MetaMask Responsive UI', function () {
it('Importing existing wallet from lock page', async function () {
const driverOptions = { openDevToolsForTabs: true };
const testSeedPhrase =
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent';
await withFixtures(
{
@ -98,7 +100,7 @@ describe('MetaMask Responsive UI', function () {
await driver.pasteIntoField(
'[data-testid="import-srp__srp-word-0"]',
testSeedPhrase,
TEST_SEED_PHRASE_TWO,
);
await driver.fill('#password', 'correct horse battery staple');

View File

@ -1,6 +1,7 @@
const { strict: assert } = require('assert');
const { By } = require('selenium-webdriver');
const {
TEST_SEED_PHRASE,
convertToHexValue,
withFixtures,
completeCreateNewWalletOnboardingFlow,
@ -12,8 +13,6 @@ const {
const FixtureBuilder = require('../fixture-builder');
describe('MetaMask onboarding', function () {
const testSeedPhrase =
'forum vessel pink push lonely enact gentle tail admit parrot grunt dress';
const testPassword = 'correct horse battery staple';
const wrongSeedPhrase =
'test test test test test test test test test test test test';
@ -63,7 +62,7 @@ describe('MetaMask onboarding', function () {
await completeImportSRPOnboardingFlow(
driver,
testSeedPhrase,
TEST_SEED_PHRASE,
testPassword,
);
@ -164,7 +163,7 @@ describe('MetaMask onboarding', function () {
// Check that the error message is displayed for the password fields
await driver.isElementPresent(
// eslint-disable-next-line prettier/prettier
{ text: 'Passwords don\'t match', tag: 'h6' },
{ text: "Passwords don't match", tag: 'h6' },
true,
);
@ -188,7 +187,7 @@ describe('MetaMask onboarding', function () {
async ({ driver }) => {
await driver.navigate();
await importSRPOnboardingFlow(driver, testSeedPhrase, testPassword);
await importSRPOnboardingFlow(driver, TEST_SEED_PHRASE, testPassword);
// Verify site
assert.equal(
await driver.isElementPresent({
@ -267,7 +266,7 @@ describe('MetaMask onboarding', function () {
async ({ driver, secondaryGanacheServer }) => {
await driver.navigate();
await importSRPOnboardingFlow(driver, testSeedPhrase, testPassword);
await importSRPOnboardingFlow(driver, TEST_SEED_PHRASE, testPassword);
// Add custome network localhost 8546 during onboarding
await driver.clickElement({ text: 'Advanced configuration', tag: 'a' });