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

add test: Import Account using private key of an already active account should result in an error (#13673)

This commit is contained in:
Alex Donesky 2022-02-23 15:23:06 -06:00 committed by GitHub
parent 6dd141ebfd
commit 7af75e13a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,6 +231,47 @@ 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: 'import-ui',
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
await driver.clickElement('.account-menu__icon');
await driver.clickElement({ text: 'Import Account', tag: 'div' });
// enter private key',
await driver.fill('#private-key-box', testPrivateKey);
await driver.clickElement({ text: 'Import', tag: 'button' });
// error should occur
await driver.waitForSelector({
css: '.error',
text: "The account you're are trying to import is a duplicate",
});
},
);
});
it('Connects to a Hardware wallet', async function () {
const ganacheOptions = {
accounts: [