mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
parent
17af3bb11e
commit
88a6f3787c
50
test/e2e/restore/MetaMaskUserData.json
Normal file
50
test/e2e/restore/MetaMaskUserData.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"addressBook": {
|
||||
"addressBook": {
|
||||
"0x539": {
|
||||
"0x0c54FcCd2e384b4BB6f2E405Bf5Cbc15a017AaFb": {
|
||||
"address": "0x0c54FcCd2e384b4BB6f2E405Bf5Cbc15a017AaFb",
|
||||
"chainId": "0x539",
|
||||
"isEns": false,
|
||||
"memo": "",
|
||||
"name": "Test Account"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"preferences": {
|
||||
"advancedGasFee": null,
|
||||
"currentLocale": "en",
|
||||
"dismissSeedBackUpReminder": true,
|
||||
"featureFlags": {
|
||||
"showIncomingTransactions": true
|
||||
},
|
||||
"forgottenPassword": false,
|
||||
"frequentRpcListDetail": [
|
||||
{
|
||||
"chainId": "0x539",
|
||||
"nickname": "Localhost 8545",
|
||||
"rpcPrefs": {},
|
||||
"rpcUrl": "http://localhost:8545",
|
||||
"ticker": "ETH"
|
||||
}
|
||||
],
|
||||
"infuraBlocked": false,
|
||||
"ipfsGateway": "dweb.link",
|
||||
"knownMethodData": {},
|
||||
"ledgerTransportType": "webhid",
|
||||
"openSeaEnabled": false,
|
||||
"preferences": {
|
||||
"hideZeroBalanceTokens": false,
|
||||
"showFiatInTestnets": false,
|
||||
"showTestNetworks": false,
|
||||
"useNativeCurrencyAsPrimaryCurrency": true
|
||||
},
|
||||
"theme": "light",
|
||||
"useBlockie": false,
|
||||
"useCollectibleDetection": false,
|
||||
"useNonceField": false,
|
||||
"usePhishDetect": true,
|
||||
"useTokenDetection": false
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
const { strict: assert } = require('assert');
|
||||
const { promises: fs } = require('fs');
|
||||
const path = require('path');
|
||||
const {
|
||||
convertToHexValue,
|
||||
withFixtures,
|
||||
@ -36,7 +37,14 @@ const backupExists = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
describe('Backup', function () {
|
||||
const restoreFile = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'restore',
|
||||
'MetaMaskUserData.json',
|
||||
);
|
||||
|
||||
describe('Backup and Restore', function () {
|
||||
const ganacheOptions = {
|
||||
accounts: [
|
||||
{
|
||||
@ -46,7 +54,7 @@ describe('Backup', function () {
|
||||
},
|
||||
],
|
||||
};
|
||||
it('should create backup for the account', async function () {
|
||||
it('should backup the account settings', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
fixtures: new FixtureBuilder().build(),
|
||||
@ -79,4 +87,40 @@ describe('Backup', function () {
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('should restore the account settings', async function () {
|
||||
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);
|
||||
|
||||
// Restore
|
||||
await driver.clickElement('.account-menu__icon');
|
||||
await driver.clickElement({ text: 'Settings', tag: 'div' });
|
||||
await driver.clickElement({ text: 'Advanced', tag: 'div' });
|
||||
const restore = await driver.findElement('#restore-file');
|
||||
await restore.sendKeys(restoreFile);
|
||||
|
||||
// Dismiss success message
|
||||
await driver.waitForSelector({
|
||||
css: '.actionable-message__message',
|
||||
text: 'Your data has been restored successfully',
|
||||
});
|
||||
await driver.clickElement({ text: 'Dismiss', tag: 'button' });
|
||||
|
||||
// Verify restore
|
||||
await driver.clickElement({ text: 'Contacts', tag: 'div' });
|
||||
const recipient = await driver.findElement('[data-testid="recipient"]');
|
||||
assert.ok(
|
||||
/Test\sAccount\s*0x0c54...AaFb/u.test(await recipient.getText()),
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user