mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
parent
55e88a0e8e
commit
f47d02b72a
46
test/e2e/tests/auto-lock.spec.js
Normal file
46
test/e2e/tests/auto-lock.spec.js
Normal file
@ -0,0 +1,46 @@
|
||||
const { strict: assert } = require('assert');
|
||||
const { convertToHexValue, withFixtures } = require('../helpers');
|
||||
|
||||
describe('Auto-Lock Timer', function () {
|
||||
const ganacheOptions = {
|
||||
accounts: [
|
||||
{
|
||||
secretKey:
|
||||
'0x53CB0AB5226EEBF4D872113D98332C1555DC304443BEE1CF759D15798D3C55A9',
|
||||
balance: convertToHexValue(25000000000000000000),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
it('should automatically lock the wallet once the idle time has elapsed', async function () {
|
||||
await withFixtures(
|
||||
{
|
||||
fixtures: 'imported-account',
|
||||
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);
|
||||
// Set Auto Lock Timer
|
||||
await driver.clickElement('.account-menu__icon');
|
||||
await driver.clickElement({ text: 'Settings', tag: 'div' });
|
||||
await driver.clickElement({ text: 'Advanced', tag: 'div' });
|
||||
const sixSecsInMins = '.1';
|
||||
await driver.fill(
|
||||
'[data-testid="advanced-setting-auto-lock"] input',
|
||||
sixSecsInMins,
|
||||
);
|
||||
await driver.clickElement(
|
||||
'[data-testid="advanced-setting-auto-lock"] button',
|
||||
);
|
||||
// Verify the wallet is loccked
|
||||
const pageTitle = await driver.findElement('.unlock-page__title');
|
||||
const unlockButton = await driver.findElement('.unlock-page button');
|
||||
assert.equal(await pageTitle.getText(), 'Welcome Back!');
|
||||
assert.equal(await unlockButton.isDisplayed(), true);
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
@ -67,5 +67,5 @@ UserPreferencedCurrencyDisplay.propTypes = {
|
||||
PropTypes.string,
|
||||
PropTypes.number,
|
||||
]),
|
||||
showFiat: PropTypes.boolean,
|
||||
showFiat: PropTypes.bool,
|
||||
};
|
||||
|
@ -375,7 +375,7 @@ export default class AdvancedTab extends PureComponent {
|
||||
renderAutoLockTimeLimit() {
|
||||
const { t } = this.context;
|
||||
const { lockTimeError } = this.state;
|
||||
const { autoLockTimeLimit, setAutoLockTimeLimit } = this.props;
|
||||
const { setAutoLockTimeLimit } = this.props;
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -396,7 +396,6 @@ export default class AdvancedTab extends PureComponent {
|
||||
id="autoTimeout"
|
||||
placeholder="5"
|
||||
value={this.state.autoLockTimeLimit}
|
||||
defaultValue={autoLockTimeLimit}
|
||||
onChange={(e) => this.handleLockChange(e.target.value)}
|
||||
error={lockTimeError}
|
||||
fullWidth
|
||||
|
@ -38,7 +38,7 @@ export const mapStateToProps = (state) => {
|
||||
const {
|
||||
showFiatInTestnets,
|
||||
showTestNetworks,
|
||||
autoLockTimeLimit,
|
||||
autoLockTimeLimit = 0,
|
||||
} = getPreferences(state);
|
||||
|
||||
const userHasALedgerAccount = doesUserHaveALedgerAccount(state);
|
||||
|
Loading…
Reference in New Issue
Block a user