From f47d02b72a61df90ce3e3e1c6d834139226caa59 Mon Sep 17 00:00:00 2001 From: PeterYinusa <53189696+PeterYinusa@users.noreply.github.com> Date: Tue, 10 May 2022 17:57:11 +0100 Subject: [PATCH] Auto lock e2e (#14624) * add auto lock e2e test * fix console errors --- test/e2e/tests/auto-lock.spec.js | 46 +++++++++++++++++++ ...-preferenced-currency-display.component.js | 2 +- .../advanced-tab/advanced-tab.component.js | 3 +- .../advanced-tab/advanced-tab.container.js | 2 +- 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 test/e2e/tests/auto-lock.spec.js diff --git a/test/e2e/tests/auto-lock.spec.js b/test/e2e/tests/auto-lock.spec.js new file mode 100644 index 000000000..c149814b9 --- /dev/null +++ b/test/e2e/tests/auto-lock.spec.js @@ -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); + }, + ); + }); +}); diff --git a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.js b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.js index c2beced07..6dc94607f 100644 --- a/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.js +++ b/ui/components/app/user-preferenced-currency-display/user-preferenced-currency-display.component.js @@ -67,5 +67,5 @@ UserPreferencedCurrencyDisplay.propTypes = { PropTypes.string, PropTypes.number, ]), - showFiat: PropTypes.boolean, + showFiat: PropTypes.bool, }; diff --git a/ui/pages/settings/advanced-tab/advanced-tab.component.js b/ui/pages/settings/advanced-tab/advanced-tab.component.js index c8d23d292..f673f77f5 100644 --- a/ui/pages/settings/advanced-tab/advanced-tab.component.js +++ b/ui/pages/settings/advanced-tab/advanced-tab.component.js @@ -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 (