1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +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; 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 = { module.exports = {
DAPP_URL, DAPP_URL,
DAPP_ONE_URL, DAPP_ONE_URL,
SERVICE_WORKER_URL, SERVICE_WORKER_URL,
TEST_SEED_PHRASE,
TEST_SEED_PHRASE_TWO,
getWindowHandles, getWindowHandles,
convertToHexValue, convertToHexValue,
tinyDelayMs, tinyDelayMs,

View File

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

View File

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

View File

@ -1,6 +1,7 @@
const { strict: assert } = require('assert'); const { strict: assert } = require('assert');
const path = require('path'); const path = require('path');
const { const {
TEST_SEED_PHRASE,
convertToHexValue, convertToHexValue,
withFixtures, withFixtures,
regularDelayMs, regularDelayMs,
@ -11,19 +12,18 @@ const {
} = require('../helpers'); } = require('../helpers');
const FixtureBuilder = require('../fixture-builder'); const FixtureBuilder = require('../fixture-builder');
const ganacheOptions = {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
},
],
};
describe('MetaMask Import UI', function () { describe('MetaMask Import UI', function () {
it('Importing wallet using Secret Recovery Phrase', async 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 testPassword = 'correct horse battery staple';
const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3'; const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3';
@ -39,7 +39,7 @@ describe('MetaMask Import UI', function () {
await completeImportSRPOnboardingFlow( await completeImportSRPOnboardingFlow(
driver, driver,
testSeedPhrase, TEST_SEED_PHRASE,
testPassword, testPassword,
); );
@ -131,17 +131,6 @@ describe('MetaMask Import UI', function () {
}); });
it('Importing wallet using Secret Recovery Phrase with pasting word by word', async 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 testPassword = 'correct horse battery staple';
const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3'; const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3';
@ -157,7 +146,7 @@ describe('MetaMask Import UI', function () {
await completeImportSRPOnboardingFlowWordByWord( await completeImportSRPOnboardingFlowWordByWord(
driver, driver,
testSeedPhrase, TEST_SEED_PHRASE,
testPassword, testPassword,
); );
@ -178,15 +167,6 @@ describe('MetaMask Import UI', function () {
}); });
it('Import Account using private key', async function () { it('Import Account using private key', async function () {
const ganacheOptions = {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
},
],
};
const testPrivateKey1 = const testPrivateKey1 =
'14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6'; '14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6';
const testPrivateKey2 = const testPrivateKey2 =
@ -284,16 +264,6 @@ describe('MetaMask Import UI', function () {
}); });
it('Import Account using json file', async function () { it('Import Account using json file', async function () {
const ganacheOptions = {
accounts: [
{
secretKey:
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
balance: convertToHexValue(25000000000000000000),
},
],
};
await withFixtures( await withFixtures(
{ {
fixtures: new FixtureBuilder() 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 () { it('Import Account using private key of an already active account should result in an error', async function () {
const testPrivateKey = const testPrivateKey =
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9'; '0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9';
const ganacheOptions = {
accounts: [
{
secretKey: testPrivateKey,
balance: convertToHexValue(25000000000000000000),
},
],
};
await withFixtures( await withFixtures(
{ {
fixtures: new FixtureBuilder() fixtures: new FixtureBuilder()
@ -400,44 +361,36 @@ describe('MetaMask Import UI', function () {
); );
}); });
it('Connects to a Hardware wallet', async function () { if (process.env.ENABLE_MV3) {
const ganacheOptions = { it('Connects to a Hardware wallet for trezor', async function () {
accounts: [ await withFixtures(
{ {
secretKey: fixtures: new FixtureBuilder().build(),
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9', ganacheOptions,
balance: convertToHexValue(25000000000000000000), 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( // choose Connect hardware wallet from the account menu
{ await driver.clickElement('.account-menu__icon');
fixtures: new FixtureBuilder().build(), await driver.clickElement({
ganacheOptions, text: 'Connect hardware wallet',
title: this.test.title, tag: 'div',
}, });
async ({ driver }) => { await driver.delay(regularDelayMs);
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 // should open the TREZOR Connect popup
await driver.clickElement('.account-menu__icon'); await driver.clickElement('.hw-connect__btn:nth-of-type(2)');
await driver.clickElement({ await driver.delay(largeDelayMs * 2);
text: 'Connect hardware wallet', await driver.clickElement({ text: 'Continue', tag: 'button' });
tag: 'div', await driver.waitUntilXWindowHandles(2);
}); const allWindows = await driver.getAllWindowHandles();
await driver.delay(regularDelayMs); 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 { strict: assert } = require('assert');
const { convertToHexValue, withFixtures } = require('../helpers'); const {
TEST_SEED_PHRASE_TWO,
convertToHexValue,
withFixtures,
} = require('../helpers');
const FixtureBuilder = require('../fixture-builder'); const FixtureBuilder = require('../fixture-builder');
describe('MetaMask Responsive UI', function () { describe('MetaMask Responsive UI', function () {
@ -76,8 +80,6 @@ describe('MetaMask Responsive UI', function () {
it('Importing existing wallet from lock page', async function () { it('Importing existing wallet from lock page', async function () {
const driverOptions = { openDevToolsForTabs: true }; const driverOptions = { openDevToolsForTabs: true };
const testSeedPhrase =
'phrase upgrade clock rough situate wedding elder clever doctor stamp excess tent';
await withFixtures( await withFixtures(
{ {
@ -98,7 +100,7 @@ describe('MetaMask Responsive UI', function () {
await driver.pasteIntoField( await driver.pasteIntoField(
'[data-testid="import-srp__srp-word-0"]', '[data-testid="import-srp__srp-word-0"]',
testSeedPhrase, TEST_SEED_PHRASE_TWO,
); );
await driver.fill('#password', 'correct horse battery staple'); await driver.fill('#password', 'correct horse battery staple');

View File

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