2021-04-22 20:03:47 +02:00
|
|
|
const { strict: assert } = require('assert');
|
2022-04-15 18:35:25 +02:00
|
|
|
const path = require('path');
|
2022-01-19 00:08:41 +01:00
|
|
|
const {
|
2023-05-26 15:05:34 +02:00
|
|
|
TEST_SEED_PHRASE,
|
2022-01-19 00:08:41 +01:00
|
|
|
convertToHexValue,
|
|
|
|
withFixtures,
|
|
|
|
regularDelayMs,
|
|
|
|
largeDelayMs,
|
2022-02-23 18:27:13 +01:00
|
|
|
completeImportSRPOnboardingFlow,
|
2022-05-09 14:46:20 +02:00
|
|
|
completeImportSRPOnboardingFlowWordByWord,
|
2023-05-24 19:50:31 +02:00
|
|
|
findAnotherAccountFromAccountList,
|
2022-01-19 00:08:41 +01:00
|
|
|
} = require('../helpers');
|
2022-10-28 10:42:12 +02:00
|
|
|
const FixtureBuilder = require('../fixture-builder');
|
2021-04-22 20:03:47 +02:00
|
|
|
|
2023-05-26 15:05:34 +02:00
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
|
|
|
|
balance: convertToHexValue(25000000000000000000),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2022-06-03 20:42:48 +02:00
|
|
|
describe('MetaMask Import UI', function () {
|
2021-05-07 15:07:43 +02:00
|
|
|
it('Importing wallet using Secret Recovery Phrase', async function () {
|
2022-02-23 18:27:13 +01:00
|
|
|
const testPassword = 'correct horse battery staple';
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder({ onboarding: true }).build(),
|
2021-04-22 20:03:47 +02:00
|
|
|
ganacheOptions,
|
|
|
|
title: this.test.title,
|
|
|
|
failOnConsoleError: false,
|
|
|
|
},
|
|
|
|
async ({ driver }) => {
|
|
|
|
await driver.navigate();
|
|
|
|
|
2022-02-23 18:27:13 +01:00
|
|
|
await completeImportSRPOnboardingFlow(
|
|
|
|
driver,
|
2023-05-26 15:05:34 +02:00
|
|
|
TEST_SEED_PHRASE,
|
2022-02-23 18:27:13 +01:00
|
|
|
testPassword,
|
|
|
|
);
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// Show account information
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
2021-04-22 20:03:47 +02:00
|
|
|
await driver.clickElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'[data-testid="account-list-item-menu-button"]',
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-list-menu-details"');
|
2021-04-22 20:03:47 +02:00
|
|
|
await driver.findVisibleElement('.qr-code__wrapper');
|
2023-06-01 23:14:38 +02:00
|
|
|
|
2021-04-22 20:03:47 +02:00
|
|
|
// shows a QR code for the account
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.findVisibleElement('.popover-container');
|
2021-04-22 20:03:47 +02:00
|
|
|
// shows the correct account address
|
2023-06-01 23:14:38 +02:00
|
|
|
const address = await driver.findElement(
|
|
|
|
'.multichain-address-copy-button',
|
|
|
|
);
|
|
|
|
assert.equal(await address.getText(), '0x0Cc...afD3');
|
2021-04-22 20:03:47 +02:00
|
|
|
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="popover-close"]');
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// logs out of the account
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement(
|
|
|
|
'[data-testid="account-options-menu-button"]',
|
|
|
|
);
|
2021-04-22 20:03:47 +02:00
|
|
|
const lockButton = await driver.findClickableElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'[data-testid="global-menu-lock"]',
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
2023-06-01 23:14:38 +02:00
|
|
|
assert.equal(await lockButton.getText(), 'Lock MetaMask');
|
2021-04-22 20:03:47 +02:00
|
|
|
await lockButton.click();
|
|
|
|
|
|
|
|
// accepts the account password after lock
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
|
|
|
// Create a new account
|
2022-05-16 20:38:04 +02:00
|
|
|
// switches to localhost
|
|
|
|
await driver.delay(largeDelayMs);
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="network-display"]');
|
|
|
|
await driver.clickElement('.toggle-button');
|
2021-04-22 20:03:47 +02:00
|
|
|
await driver.clickElement({ text: 'Localhost', tag: 'span' });
|
|
|
|
|
2022-08-08 21:01:38 +02:00
|
|
|
// choose Create account from the account menu
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
|
|
|
await driver.clickElement({ text: 'Add account', tag: 'button' });
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// set account name
|
2023-06-13 17:07:01 +02:00
|
|
|
await driver.fill('[placeholder="Account 2"]', '2nd account');
|
2021-04-22 20:03:47 +02:00
|
|
|
await driver.delay(regularDelayMs);
|
|
|
|
await driver.clickElement({ text: 'Create', tag: 'button' });
|
|
|
|
|
|
|
|
// should show the correct account name
|
2023-06-01 23:14:38 +02:00
|
|
|
const accountName = await driver.isElementPresent({
|
|
|
|
tag: 'span',
|
|
|
|
text: '2nd account',
|
|
|
|
});
|
|
|
|
|
|
|
|
assert.equal(accountName, true, 'Account name is not correct');
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// Switch back to original account
|
|
|
|
// chooses the original account from the account menu
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
|
|
|
await driver.clickElement(
|
|
|
|
'.multichain-account-list-item__account-name__button',
|
|
|
|
);
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// Send ETH from inside MetaMask
|
|
|
|
// starts a send transaction
|
|
|
|
await driver.clickElement('[data-testid="eth-overview-send"]');
|
|
|
|
await driver.fill(
|
2023-06-08 19:09:39 +02:00
|
|
|
'input[placeholder="Enter public address (0x) or ENS name"]',
|
2021-04-22 20:03:47 +02:00
|
|
|
'0x2f318C334780961FB129D2a6c30D0763d9a5C970',
|
|
|
|
);
|
|
|
|
await driver.fill('.unit-input__input', '1');
|
|
|
|
|
|
|
|
// Continue to next screen
|
|
|
|
await driver.clickElement({ text: 'Next', tag: 'button' });
|
|
|
|
|
|
|
|
// confirms the transaction
|
|
|
|
await driver.clickElement({ text: 'Confirm', tag: 'button' });
|
|
|
|
|
|
|
|
// finds the transaction in the transactions list
|
|
|
|
await driver.clickElement('[data-testid="home__activity-tab"]');
|
|
|
|
await driver.wait(async () => {
|
|
|
|
const confirmedTxes = await driver.findElements(
|
|
|
|
'.transaction-list__completed-transactions .transaction-list-item',
|
|
|
|
);
|
|
|
|
return confirmedTxes.length === 1;
|
|
|
|
}, 10000);
|
|
|
|
|
|
|
|
const txValues = await driver.findElements(
|
|
|
|
'.transaction-list-item__primary-currency',
|
|
|
|
);
|
|
|
|
assert.equal(txValues.length, 1);
|
|
|
|
assert.ok(/-1\s*ETH/u.test(await txValues[0].getText()));
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2022-05-09 14:46:20 +02:00
|
|
|
it('Importing wallet using Secret Recovery Phrase with pasting word by word', async function () {
|
|
|
|
const testPassword = 'correct horse battery staple';
|
|
|
|
const testAddress = '0x0Cc5261AB8cE458dc977078A3623E2BaDD27afD3';
|
|
|
|
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder({ onboarding: true }).build(),
|
2022-05-09 14:46:20 +02:00
|
|
|
ganacheOptions,
|
|
|
|
title: this.test.title,
|
|
|
|
failOnConsoleError: false,
|
|
|
|
},
|
|
|
|
async ({ driver }) => {
|
|
|
|
await driver.navigate();
|
|
|
|
|
|
|
|
await completeImportSRPOnboardingFlowWordByWord(
|
|
|
|
driver,
|
2023-05-26 15:05:34 +02:00
|
|
|
TEST_SEED_PHRASE,
|
2022-05-09 14:46:20 +02:00
|
|
|
testPassword,
|
|
|
|
);
|
|
|
|
|
|
|
|
// Show account information
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
2022-05-09 14:46:20 +02:00
|
|
|
await driver.clickElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'[data-testid="account-list-item-menu-button"]',
|
2022-05-09 14:46:20 +02:00
|
|
|
);
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-list-menu-details"');
|
2022-05-09 14:46:20 +02:00
|
|
|
await driver.findVisibleElement('.qr-code__wrapper');
|
|
|
|
// shows the correct account address
|
2023-06-01 23:14:38 +02:00
|
|
|
const address = await driver.findElement(
|
|
|
|
'.qr-code [data-testid="address-copy-button-text"]',
|
|
|
|
);
|
2022-05-09 14:46:20 +02:00
|
|
|
|
|
|
|
assert.equal(await address.getText(), testAddress);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2021-04-22 20:03:47 +02:00
|
|
|
it('Import Account using private key', async function () {
|
|
|
|
const testPrivateKey1 =
|
|
|
|
'14abe6f4aab7f9f626fe981c864d0adeb5685f289ac9270c27b8fd790b4235d6';
|
|
|
|
const testPrivateKey2 =
|
|
|
|
'F4EC2590A0C10DE95FBF4547845178910E40F5035320C516A18C117DE02B5669';
|
|
|
|
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder()
|
|
|
|
.withKeyringControllerImportedAccountVault()
|
|
|
|
.withPreferencesControllerImportedAccountIdentities()
|
|
|
|
.build(),
|
2021-04-22 20:03:47 +02:00
|
|
|
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);
|
|
|
|
|
|
|
|
// Imports an account with private key
|
2022-08-08 21:01:38 +02:00
|
|
|
// choose Create account from the account menu
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
|
|
|
await driver.clickElement({ text: 'Import account', tag: 'button' });
|
2021-04-22 20:03:47 +02:00
|
|
|
|
2023-06-05 15:15:47 +02:00
|
|
|
// enter private key
|
|
|
|
await driver.findClickableElement('#private-key-box');
|
2021-04-22 20:03:47 +02:00
|
|
|
await driver.fill('#private-key-box', testPrivateKey1);
|
2023-06-13 17:07:01 +02:00
|
|
|
await driver.clickElement(
|
|
|
|
'[data-testid="import-account-confirm-button"]',
|
|
|
|
);
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// should show the correct account name
|
|
|
|
const importedAccountName = await driver.findElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'[data-testid="account-menu-icon"]',
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
|
|
|
assert.equal(await importedAccountName.getText(), 'Account 4');
|
|
|
|
|
|
|
|
// should show the imported label
|
|
|
|
// confirm 4th account is account 4, as expected
|
2023-05-24 19:50:31 +02:00
|
|
|
const accountMenuItemSelector = await findAnotherAccountFromAccountList(
|
|
|
|
driver,
|
|
|
|
4,
|
|
|
|
'Account 4',
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
|
|
|
// confirm label is present on the same menu item
|
|
|
|
const importedLabel = await driver.findElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
`${accountMenuItemSelector} .mm-tag`,
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
2023-06-01 23:14:38 +02:00
|
|
|
assert.equal(await importedLabel.getText(), 'Imported');
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// Imports and removes an account
|
2022-08-08 21:01:38 +02:00
|
|
|
// choose Create account from the account menu
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement({ text: 'Import account', tag: 'button' });
|
2021-04-22 20:03:47 +02:00
|
|
|
// enter private key
|
2023-06-05 15:15:47 +02:00
|
|
|
await driver.findClickableElement('#private-key-box');
|
2021-04-22 20:03:47 +02:00
|
|
|
await driver.fill('#private-key-box', testPrivateKey2);
|
2023-06-13 17:07:01 +02:00
|
|
|
await driver.clickElement(
|
|
|
|
'[data-testid="import-account-confirm-button"]',
|
|
|
|
);
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// should see new account in account menu
|
|
|
|
const importedAccount2Name = await driver.findElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'[data-testid="account-menu-icon"]',
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
|
|
|
assert.equal(await importedAccount2Name.getText(), 'Account 5');
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
2021-04-22 20:03:47 +02:00
|
|
|
const accountListItems = await driver.findElements(
|
2023-06-01 23:14:38 +02:00
|
|
|
'.multichain-account-list-item',
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
|
|
|
assert.equal(accountListItems.length, 5);
|
|
|
|
|
|
|
|
await driver.clickElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'.multichain-account-list-item--selected [data-testid="account-list-item-menu-button"]',
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
2023-06-01 23:14:38 +02:00
|
|
|
|
|
|
|
await driver.clickElement('[data-testid="account-list-menu-remove"]');
|
2021-04-22 20:03:47 +02:00
|
|
|
|
|
|
|
// should remove the account
|
|
|
|
await driver.clickElement({ text: 'Remove', tag: 'button' });
|
|
|
|
|
2021-11-10 11:00:42 +01:00
|
|
|
// Wait until selected account switches away from removed account to first account
|
2023-03-28 14:59:41 +02:00
|
|
|
await driver.waitForSelector({
|
2023-06-01 23:14:38 +02:00
|
|
|
css: '[data-testid="account-menu-icon"]',
|
2023-03-28 14:59:41 +02:00
|
|
|
text: 'Account 1',
|
|
|
|
});
|
2021-11-10 11:00:42 +01:00
|
|
|
|
2021-04-22 20:03:47 +02:00
|
|
|
await driver.delay(regularDelayMs);
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
2021-04-22 20:03:47 +02:00
|
|
|
|
2022-01-21 16:54:03 +01:00
|
|
|
const accountListItemsAfterRemoval = await driver.findElements(
|
2023-06-01 23:14:38 +02:00
|
|
|
'.multichain-account-list-item',
|
2021-04-22 20:03:47 +02:00
|
|
|
);
|
2022-01-21 16:54:03 +01:00
|
|
|
assert.equal(accountListItemsAfterRemoval.length, 4);
|
2021-04-22 20:03:47 +02:00
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
2022-02-23 22:23:06 +01:00
|
|
|
|
2022-04-15 18:35:25 +02:00
|
|
|
it('Import Account using json file', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder()
|
|
|
|
.withKeyringControllerImportedAccountVault()
|
|
|
|
.withPreferencesControllerImportedAccountIdentities()
|
|
|
|
.build(),
|
2022-04-15 18:35:25 +02:00
|
|
|
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);
|
|
|
|
|
|
|
|
// Imports an account with JSON file
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
|
|
|
await driver.clickElement({ text: 'Import account', tag: 'button' });
|
2022-04-15 18:35:25 +02:00
|
|
|
|
2023-03-06 18:48:28 +01:00
|
|
|
await driver.clickElement('.dropdown__select');
|
2022-04-15 18:35:25 +02:00
|
|
|
await driver.clickElement({ text: 'JSON File', tag: 'option' });
|
|
|
|
|
|
|
|
const fileInput = await driver.findElement('input[type="file"]');
|
|
|
|
const importJsonFile = path.join(
|
|
|
|
__dirname,
|
|
|
|
'..',
|
|
|
|
'import-utc-json',
|
|
|
|
'test-json-import-account-file.json',
|
|
|
|
);
|
|
|
|
|
|
|
|
fileInput.sendKeys(importJsonFile);
|
|
|
|
|
|
|
|
await driver.fill('#json-password-box', 'foobarbazqux');
|
2023-06-13 17:07:01 +02:00
|
|
|
await driver.clickElement(
|
|
|
|
'[data-testid="import-account-confirm-button"]',
|
|
|
|
);
|
2022-04-15 18:35:25 +02:00
|
|
|
|
|
|
|
// should show the correct account name
|
|
|
|
const importedAccountName = await driver.findElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'[data-testid="account-menu-icon"]',
|
2022-04-15 18:35:25 +02:00
|
|
|
);
|
|
|
|
assert.equal(await importedAccountName.getText(), 'Account 4');
|
|
|
|
|
|
|
|
// should show the imported label
|
|
|
|
// confirm 4th account is account 4, as expected
|
2023-05-24 19:50:31 +02:00
|
|
|
const accountMenuItemSelector = await findAnotherAccountFromAccountList(
|
|
|
|
driver,
|
|
|
|
4,
|
|
|
|
'Account 4',
|
2022-04-15 18:35:25 +02:00
|
|
|
);
|
2023-05-24 19:50:31 +02:00
|
|
|
|
2022-04-15 18:35:25 +02:00
|
|
|
// confirm label is present on the same menu item
|
|
|
|
const importedLabel = await driver.findElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
`${accountMenuItemSelector} .mm-tag`,
|
2022-04-15 18:35:25 +02:00
|
|
|
);
|
2023-06-01 23:14:38 +02:00
|
|
|
assert.equal(await importedLabel.getText(), 'Imported');
|
2022-04-15 18:35:25 +02:00
|
|
|
|
|
|
|
const accountListItems = await driver.findElements(
|
2023-06-01 23:14:38 +02:00
|
|
|
'.multichain-account-list-item',
|
2022-04-15 18:35:25 +02:00
|
|
|
);
|
|
|
|
assert.equal(accountListItems.length, 4);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2022-02-23 22:23:06 +01:00
|
|
|
it('Import Account using private key of an already active account should result in an error', async function () {
|
|
|
|
const testPrivateKey =
|
|
|
|
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9';
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder()
|
|
|
|
.withKeyringControllerImportedAccountVault()
|
|
|
|
.withPreferencesControllerImportedAccountIdentities()
|
|
|
|
.build(),
|
2022-02-23 22:23:06 +01:00
|
|
|
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 Import Account from the account menu
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
|
|
|
await driver.clickElement({ text: 'Import account', tag: 'button' });
|
2022-02-23 22:23:06 +01:00
|
|
|
|
2023-06-05 15:15:47 +02:00
|
|
|
// enter private key
|
|
|
|
await driver.findClickableElement('#private-key-box');
|
2022-02-23 22:23:06 +01:00
|
|
|
await driver.fill('#private-key-box', testPrivateKey);
|
2023-06-13 17:07:01 +02:00
|
|
|
await driver.clickElement(
|
|
|
|
'[data-testid="import-account-confirm-button"]',
|
|
|
|
);
|
2022-02-23 22:23:06 +01:00
|
|
|
|
|
|
|
// error should occur
|
|
|
|
await driver.waitForSelector({
|
2023-03-06 18:48:28 +01:00
|
|
|
css: '.mm-help-text',
|
2022-11-24 01:49:24 +01:00
|
|
|
text: 'The account you are trying to import is a duplicate',
|
2022-02-23 22:23:06 +01:00
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2023-05-26 15:05:34 +02:00
|
|
|
if (process.env.ENABLE_MV3) {
|
|
|
|
it('Connects to a Hardware wallet for trezor', async function () {
|
|
|
|
await withFixtures(
|
2021-04-22 20:03:47 +02:00
|
|
|
{
|
2023-05-26 15:05:34 +02:00
|
|
|
fixtures: new FixtureBuilder().build(),
|
|
|
|
ganacheOptions,
|
|
|
|
title: this.test.title,
|
2021-04-22 20:03:47 +02:00
|
|
|
},
|
2023-05-26 15:05:34 +02:00
|
|
|
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
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement('[data-testid="account-menu-icon"]');
|
2023-05-26 15:05:34 +02:00
|
|
|
await driver.clickElement({
|
2023-06-01 23:14:38 +02:00
|
|
|
text: 'Hardware wallet',
|
|
|
|
tag: 'button',
|
2023-05-26 15:05:34 +02:00
|
|
|
});
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
2021-04-22 20:03:47 +02:00
|
|
|
});
|