2021-06-24 16:19:31 +02:00
|
|
|
const { strict: assert } = require('assert');
|
2022-01-19 00:08:41 +01:00
|
|
|
const { convertToHexValue, withFixtures } = require('../helpers');
|
2022-10-28 10:42:12 +02:00
|
|
|
const FixtureBuilder = require('../fixture-builder');
|
2021-06-24 16:19:31 +02:00
|
|
|
|
|
|
|
describe('Lock and unlock', function () {
|
|
|
|
const ganacheOptions = {
|
|
|
|
accounts: [
|
|
|
|
{
|
|
|
|
secretKey:
|
|
|
|
'0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC',
|
2022-01-19 00:08:41 +01:00
|
|
|
balance: convertToHexValue(25000000000000000000),
|
2021-06-24 16:19:31 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
it('successfully unlocks after lock', async function () {
|
|
|
|
await withFixtures(
|
|
|
|
{
|
2022-10-28 10:42:12 +02:00
|
|
|
fixtures: new FixtureBuilder().build(),
|
2021-06-24 16:19:31 +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);
|
|
|
|
|
2023-06-01 23:14:38 +02:00
|
|
|
await driver.clickElement(
|
|
|
|
'[data-testid="account-options-menu-button"]',
|
|
|
|
);
|
2021-06-24 16:19:31 +02:00
|
|
|
const lockButton = await driver.findClickableElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'[data-testid="global-menu-lock"]',
|
2021-06-24 16:19:31 +02:00
|
|
|
);
|
2023-06-01 23:14:38 +02:00
|
|
|
assert.equal(await lockButton.getText(), 'Lock MetaMask');
|
2021-06-24 16:19:31 +02:00
|
|
|
await lockButton.click();
|
|
|
|
await driver.fill('#password', 'correct horse battery staple');
|
|
|
|
await driver.press('#password', driver.Key.ENTER);
|
|
|
|
|
|
|
|
const walletBalance = await driver.findElement(
|
2023-06-01 23:14:38 +02:00
|
|
|
'.eth-overview__primary-balance',
|
2021-06-24 16:19:31 +02:00
|
|
|
);
|
|
|
|
assert.equal(/^25\s*ETH$/u.test(await walletBalance.getText()), true);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|