Browse Source

Merge branch 'develop' of github.com:LedgerHQ/ledger-live-desktop into feature/test-e2e-password-lock

gre-patch-1
Arnaud97234 6 years ago
parent
commit
22066a9b91
No known key found for this signature in database GPG Key ID: C77229DB9ECCFE6
  1. 1
      .prettierignore
  2. 4
      package.json
  3. 6
      src/bridge/EthereumJSBridge.js
  4. 10
      src/bridge/LibcoreBridge.js
  5. 34
      src/bridge/RippleJSBridge.js
  6. 4
      src/bridge/UnsupportedBridge.js
  7. 8
      src/bridge/makeMockBridge.js
  8. 7
      src/bridge/types.js
  9. 2
      src/commands/index.js
  10. 18
      src/commands/killInternalProcess.js
  11. 19
      src/components/AdvancedOptions/RippleKind.js
  12. 5
      src/components/ExchangePage/index.js
  13. 62
      src/components/ManagerPage/AppsList.js
  14. 7
      src/components/ManagerPage/index.js
  15. 2
      src/components/Onboarding/steps/Analytics.js
  16. 8
      src/components/RequestAmount/index.js
  17. 1
      src/components/base/Modal/ConfirmModal.js
  18. 16
      src/components/modals/Send/fields/AmountField.js
  19. 10
      src/components/modals/Send/steps/01-step-amount.js
  20. 29
      src/helpers/countervalues.js
  21. 4
      src/helpers/reset.js
  22. 2
      src/reducers/settings.js
  23. 2
      static/i18n/en/app.json
  24. 32
      test-e2e/password-lock-check.spec.js
  25. 6
      yarn.lock

1
.prettierignore

@ -1 +1,2 @@
package.json
test-e2e/sync/data

4
package.json

@ -18,7 +18,7 @@
"test": "jest src",
"test-e2e": "jest test-e2e",
"test-sync": "bash test-e2e/sync/launch.sh",
"prettier": "prettier --write \"{src,webpack,.storybook,test-e2e, test-e2e/sync/data}/**/*.{js,json}\"",
"prettier": "prettier --write \"{src,webpack,.storybook,test-e2e}/**/*.{js,json}\"",
"ci": "yarn lint && yarn flow && yarn prettier && yarn test",
"storybook": "NODE_ENV=development STORYBOOK_ENV=1 start-storybook -s ./static -p 4444",
"publish-storybook": "bash ./scripts/legacy/publish-storybook.sh",
@ -40,7 +40,7 @@
"@ledgerhq/hw-transport": "^4.13.0",
"@ledgerhq/hw-transport-node-hid": "4.22.0",
"@ledgerhq/ledger-core": "2.0.0-rc.7",
"@ledgerhq/live-common": "^3.5.1",
"@ledgerhq/live-common": "^3.7.1",
"animated": "^0.2.2",
"async": "^2.6.1",
"axios": "^0.18.0",

6
src/bridge/EthereumJSBridge.js

@ -420,15 +420,13 @@ const EthereumBridge: WalletBridge<Transaction> = {
getTransactionRecipient: (a, t) => t.recipient,
isValidTransaction: (a, t) => (!t.amount.isZero() && t.recipient && true) || false,
EditFees,
EditAdvancedOptions,
checkCanBeSpent: (a, t) =>
checkValidTransaction: (a, t) =>
t.amount.isLessThanOrEqualTo(a.balance)
? Promise.resolve()
? Promise.resolve(true)
: Promise.reject(new NotEnoughBalance()),
getTotalSpent: (a, t) =>

10
src/bridge/LibcoreBridge.js

@ -94,11 +94,11 @@ const getFees = async (a, transaction) => {
return promise
}
const checkCanBeSpent = (a, t) =>
const checkValidTransaction = (a, t) =>
!t.amount
? Promise.resolve()
? Promise.resolve(true)
: getFees(a, t)
.then(() => {})
.then(() => true)
.catch(e => {
if (e.code === NOT_ENOUGH_FUNDS) {
throw new NotEnoughBalance()
@ -191,9 +191,7 @@ const LibcoreBridge: WalletBridge<Transaction> = {
// EditAdvancedOptions,
isValidTransaction: (a, t) => (!t.amount.isZero() && t.recipient && true) || false,
checkCanBeSpent,
checkValidTransaction,
getTotalSpent: (a, t) =>
t.amount.isZero()

34
src/bridge/RippleJSBridge.js

@ -463,10 +463,30 @@ const RippleJSBridge: WalletBridge<Transaction> = {
getTransactionAmount: (a, t) => t.amount,
editTransactionRecipient: (account, t, recipient) => ({
...t,
recipient,
}),
editTransactionRecipient: (account, t, recipient) => {
const parts = recipient.split('?')
const params = new URLSearchParams(parts[1])
recipient = parts[0]
// Extract parameters we may need
for (const [key, value] of params.entries()) {
switch (key) {
case 'dt':
t.tag = parseInt(value, 10) || 0
break
case 'amount':
t.amount = parseAPIValue(value || '0')
break
default:
// do nothing
}
}
return {
...t,
recipient,
}
},
EditFees,
@ -474,9 +494,7 @@ const RippleJSBridge: WalletBridge<Transaction> = {
getTransactionRecipient: (a, t) => t.recipient,
isValidTransaction: (a, t) => (!t.amount.isZero() && t.recipient && true) || false,
checkCanBeSpent: async (a, t) => {
checkValidTransaction: async (a, t) => {
const r = await getServerInfo(a.endpointConfig)
if (
t.amount
@ -484,7 +502,7 @@ const RippleJSBridge: WalletBridge<Transaction> = {
.plus(parseAPIValue(r.validatedLedger.reserveBaseXRP))
.isLessThanOrEqualTo(a.balance)
) {
return
return true
}
throw new NotEnoughBalance()
},

4
src/bridge/UnsupportedBridge.js

@ -27,13 +27,11 @@ const UnsupportedBridge: WalletBridge<*> = {
getTransactionAmount: () => BigNumber(0),
isValidTransaction: () => false,
editTransactionRecipient: () => null,
getTransactionRecipient: () => '',
checkCanBeSpent: () => Promise.resolve(),
checkValidTransaction: () => Promise.resolve(false),
getTotalSpent: () => Promise.resolve(BigNumber(0)),

8
src/bridge/makeMockBridge.js

@ -18,7 +18,7 @@ const defaultOpts = {
scanAccountDeviceSuccessRate: 0.8,
transactionsSizeTarget: 100,
extraInitialTransactionProps: () => null,
checkCanBeSpent: () => Promise.resolve(),
checkValidTransaction: () => Promise.resolve(),
getTotalSpent: (a, t) => Promise.resolve(t.amount),
getMaxAmount: a => Promise.resolve(a.balance),
}
@ -36,7 +36,7 @@ function makeMockBridge(opts?: Opts): WalletBridge<*> {
extraInitialTransactionProps,
getTotalSpent,
getMaxAmount,
checkCanBeSpent,
checkValidTransaction,
} = {
...defaultOpts,
...opts,
@ -155,9 +155,7 @@ function makeMockBridge(opts?: Opts): WalletBridge<*> {
EditAdvancedOptions,
isValidTransaction: (a, t) => (t.amount > 0 && t.recipient && true) || false,
checkCanBeSpent,
checkValidTransaction,
getTotalSpent,

7
src/bridge/types.js

@ -76,15 +76,16 @@ export interface WalletBridge<Transaction> {
getTransactionRecipient(account: Account, transaction: Transaction): string;
isValidTransaction(account: Account, transaction: Transaction): boolean;
// render the whole Fees section of the form
EditFees?: *; // React$ComponentType<EditProps<Transaction>>;
// render the whole advanced part of the form
EditAdvancedOptions?: *; // React$ComponentType<EditProps<Transaction>>;
checkCanBeSpent(account: Account, transaction: Transaction): Promise<void>;
// validate the transaction and all currency specific validations here, we can return false
// to disable the button without throwing an error if we are handling the error on a different
// input or throw an error that will highlight the issue on the amount field
checkValidTransaction(account: Account, transaction: Transaction): Promise<boolean>;
getTotalSpent(account: Account, transaction: Transaction): Promise<BigNumber>;

2
src/commands/index.js

@ -15,6 +15,7 @@ import installFinalFirmware from 'commands/installFinalFirmware'
import installMcu from 'commands/installMcu'
import installOsuFirmware from 'commands/installOsuFirmware'
import isDashboardOpen from 'commands/isDashboardOpen'
import killInternalProcess from 'commands/killInternalProcess'
import libcoreGetFees from 'commands/libcoreGetFees'
import libcoreGetVersion from 'commands/libcoreGetVersion'
import libcoreScanAccounts from 'commands/libcoreScanAccounts'
@ -47,6 +48,7 @@ const all: Array<Command<any, any>> = [
installMcu,
installOsuFirmware,
isDashboardOpen,
killInternalProcess,
libcoreGetFees,
libcoreGetVersion,
libcoreScanAccounts,

18
src/commands/killInternalProcess.js

@ -0,0 +1,18 @@
// @flow
import { createCommand, Command } from 'helpers/ipc'
import { of } from 'rxjs'
type Input = void
type Result = boolean
const cmd: Command<Input, Result> = createCommand('killInternalProcess', () => {
setTimeout(() => {
// we assume commands are run on the internal process
// special exit code for better identification
process.exit(42)
})
return of(true)
})
export default cmd

19
src/components/AdvancedOptions/RippleKind.js

@ -6,7 +6,6 @@ import { translate } from 'react-i18next'
import Box from 'components/base/Box'
import Input from 'components/base/Input'
import Label from 'components/base/Label'
import Spoiler from 'components/base/Spoiler'
type Props = {
tag: ?number,
@ -31,18 +30,14 @@ class RippleKind extends Component<Props> {
render() {
const { tag, t } = this.props
return (
<Spoiler title={t('app:send.steps.amount.advancedOptions')}>
<Box horizontal align="center" flow={5}>
<Box style={{ width: 200 }}>
<Label>
<span>{t('app:send.steps.amount.rippleTag')}</span>
</Label>
</Box>
<Box grow>
<Input value={String(tag || '')} onChange={this.onChange} />
</Box>
<Box vertical flow={5}>
<Box grow>
<Label>
<span>{t('app:send.steps.amount.rippleTag')}</span>
</Label>
<Input value={String(tag || '')} onChange={this.onChange} />
</Box>
</Spoiler>
</Box>
)
}
}

5
src/components/ExchangePage/index.js

@ -2,6 +2,7 @@
import React, { PureComponent } from 'react'
import { translate } from 'react-i18next'
import shuffle from 'lodash/shuffle'
import type { T } from 'types/common'
import { urls } from 'config/urls'
@ -21,7 +22,7 @@ type Props = {
t: T,
}
const cards = [
const cards = shuffle([
{
key: 'coinhouse',
id: 'coinhouse',
@ -70,7 +71,7 @@ const cards = [
url: urls.genesis,
logo: <img src={i('logos/exchanges/genesis.svg')} alt="Genesis" width={150} />,
},
]
])
class ExchangePage extends PureComponent<Props> {
render() {

62
src/components/ManagerPage/AppsList.js

@ -7,15 +7,13 @@ import { translate } from 'react-i18next'
import { connect } from 'react-redux'
import { compose } from 'redux'
import type { Device, T } from 'types/common'
import type { Application, ApplicationVersion, DeviceInfo } from 'helpers/types'
import type { ApplicationVersion, DeviceInfo } from 'helpers/types'
import { getFullListSortedCryptoCurrencies } from 'helpers/countervalues'
import { developerModeSelector } from 'reducers/settings'
import listApps from 'commands/listApps'
import listAppVersions from 'commands/listAppVersions'
import installApp from 'commands/installApp'
import uninstallApp from 'commands/uninstallApp'
import Box from 'components/base/Box'
import Space from 'components/base/Space'
import Modal, { ModalBody, ModalFooter, ModalTitle, ModalContent } from 'components/base/Modal'
@ -26,13 +24,11 @@ import Spinner from 'components/base/Spinner'
import Button from 'components/base/Button'
import TranslatedError from 'components/TranslatedError'
import TrackPage from 'analytics/TrackPage'
import IconInfoCircle from 'icons/InfoCircle'
import ExclamationCircleThin from 'icons/ExclamationCircleThin'
import Update from 'icons/Update'
import Trash from 'icons/Trash'
import CheckCircle from 'icons/CheckCircle'
import { FreezeDeviceChangeEvents } from './HookDeviceChange'
import ManagerApp, { Container as FakeManagerAppContainer } from './ManagerApp'
import AppSearchBar from './AppSearchBar'
@ -102,29 +98,53 @@ class AppsList extends PureComponent<Props, State> {
_unmounted = false
filterAppVersions = (applicationsList, compatibleAppVersionsList) => {
if (!this.props.isDevMode) {
return compatibleAppVersionsList.filter(version => {
const app = applicationsList.find(e => e.id === version.app)
if (app) {
return app.category !== 2
}
prepareAppList = ({ applicationsList, compatibleAppVersionsList, sortedCryptoCurrencies }) => {
const filtered = this.props.isDevMode
? compatibleAppVersionsList.slice(0)
: compatibleAppVersionsList.filter(version => {
const app = applicationsList.find(e => e.id === version.app)
if (app) {
return app.category !== 2
}
return false
})
}
return compatibleAppVersionsList
return false
})
const sortedCryptoApps = []
// sort by crypto first
sortedCryptoCurrencies.forEach(crypto => {
const app = filtered.find(
item => item.name.toLowerCase() === crypto.managerAppName.toLowerCase(),
)
if (app) {
filtered.splice(filtered.indexOf(app), 1)
sortedCryptoApps.push(app)
}
})
return sortedCryptoApps.concat(filtered)
}
async fetchAppList() {
try {
const { deviceInfo } = this.props
const applicationsList: Array<Application> = await listApps.send().toPromise()
const compatibleAppVersionsList = await listAppVersions.send(deviceInfo).toPromise()
const filteredAppVersionsList = this.filterAppVersions(
const [
applicationsList,
compatibleAppVersionsList,
)
sortedCryptoCurrencies,
] = await Promise.all([
listApps.send().toPromise(),
listAppVersions.send(deviceInfo).toPromise(),
getFullListSortedCryptoCurrencies(),
])
const filteredAppVersionsList = this.prepareAppList({
applicationsList,
compatibleAppVersionsList,
sortedCryptoCurrencies,
})
if (!this._unmounted) {
this.setState({

7
src/components/ManagerPage/index.js

@ -4,12 +4,11 @@ import React, { PureComponent, Fragment } from 'react'
import invariant from 'invariant'
import { openURL } from 'helpers/linking'
import { urls } from 'config/urls'
import type { Device } from 'types/common'
import type { DeviceInfo } from 'helpers/types'
import { getFullListSortedCryptoCurrencies } from 'helpers/countervalues'
import Dashboard from './Dashboard'
import ManagerGenuineCheck from './ManagerGenuineCheck'
import HookDeviceChange from './HookDeviceChange'
@ -30,6 +29,10 @@ const INITIAL_STATE = {
class ManagerPage extends PureComponent<Props, State> {
state = INITIAL_STATE
componentDidMount() {
getFullListSortedCryptoCurrencies() // start fetching the crypto currencies ordering
}
// prettier-ignore
handleSuccessGenuine = ({ device, deviceInfo }: { device: Device, deviceInfo: DeviceInfo }) => { // eslint-disable-line react/no-unused-prop-types
this.setState({ isGenuine: true, device, deviceInfo })

2
src/components/Onboarding/steps/Analytics.js

@ -26,7 +26,7 @@ type State = {
}
const INITIAL_STATE = {
analyticsToggle: false,
analyticsToggle: true,
sentryLogsToggle: true,
}

8
src/components/RequestAmount/index.js

@ -48,7 +48,7 @@ type OwnProps = {
// left value (always the one which is returned)
value: BigNumber,
canBeSpentError: ?Error,
validTransactionError: ?Error,
// max left value
max: BigNumber,
@ -113,7 +113,7 @@ const mapStateToProps = (state: State, props: OwnProps) => {
export class RequestAmount extends PureComponent<Props> {
static defaultProps = {
max: BigNumber(Infinity),
canBeSpent: true,
validTransaction: true,
withMax: true,
}
@ -139,14 +139,14 @@ export class RequestAmount extends PureComponent<Props> {
renderInputs(containerProps: Object) {
// TODO move this inlined into render() for less spaghetti
const { value, account, rightCurrency, getCounterValue, canBeSpentError } = this.props
const { value, account, rightCurrency, getCounterValue, validTransactionError } = this.props
const right = getCounterValue(value) || BigNumber(0)
const rightUnit = rightCurrency.units[0]
// FIXME: no way InputCurrency pure can work here. inlined InputRight (should be static func?), inline containerProps object..
return (
<Box horizontal grow shrink>
<InputCurrency
error={canBeSpentError}
error={validTransactionError}
containerProps={containerProps}
defaultUnit={account.unit}
value={value}

1
src/components/base/Modal/ConfirmModal.js

@ -79,6 +79,7 @@ class ConfirmModal extends PureComponent<Props> {
primary={!isDanger}
danger={isDanger}
isLoading={isLoading}
disabled={isLoading}
>
{realConfirmText}
</Button>

16
src/components/modals/Send/fields/AmountField.js

@ -4,9 +4,9 @@ import Box from 'components/base/Box'
import Label from 'components/base/Label'
import RequestAmount from 'components/RequestAmount'
class AmountField extends Component<*, { canBeSpentError: ?Error }> {
class AmountField extends Component<*, { validTransactionError: ?Error }> {
state = {
canBeSpentError: null,
validTransactionError: null,
}
componentDidMount() {
this.resync()
@ -27,11 +27,11 @@ class AmountField extends Component<*, { canBeSpentError: ?Error }> {
const { account, bridge, transaction } = this.props
const syncId = ++this.syncId
try {
await bridge.checkCanBeSpent(account, transaction)
await bridge.checkValidTransaction(account, transaction)
if (this.syncId !== syncId) return
this.setState({ canBeSpentError: null })
} catch (canBeSpentError) {
this.setState({ canBeSpentError })
this.setState({ validTransactionError: null })
} catch (validTransactionError) {
this.setState({ validTransactionError })
}
}
@ -42,14 +42,14 @@ class AmountField extends Component<*, { canBeSpentError: ?Error }> {
render() {
const { bridge, account, transaction, t } = this.props
const { canBeSpentError } = this.state
const { validTransactionError } = this.state
return (
<Box flow={1}>
<Label>{t('app:send.steps.amount.amount')}</Label>
<RequestAmount
withMax={false}
account={account}
canBeSpentError={canBeSpentError}
validTransactionError={validTransactionError}
onChange={this.onChange}
value={bridge.getTransactionAmount(account, transaction)}
/>

10
src/components/modals/Send/steps/01-step-amount.js

@ -134,11 +134,13 @@ export class StepAmountFooter extends PureComponent<
bridge.getTransactionRecipient(account, transaction),
)
if (syncId !== this.syncId) return
const canBeSpent = await bridge
.checkCanBeSpent(account, transaction)
.then(() => true, () => false)
const isValidTransaction = await bridge
.checkValidTransaction(account, transaction)
.then(result => result, () => false)
if (syncId !== this.syncId) return
const canNext = isRecipientValid && canBeSpent && totalSpent.gt(0)
const canNext =
!transaction.amount.isZero() && isRecipientValid && isValidTransaction && totalSpent.gt(0)
this.setState({ totalSpent, canNext, isSyncing: false })
} catch (err) {
logger.critical(err)

29
src/helpers/countervalues.js

@ -12,6 +12,8 @@ import {
intermediaryCurrency,
} from 'reducers/settings'
import logger from 'logger'
import { listCryptoCurrencies } from '@ledgerhq/live-common/lib/helpers/currencies'
import type { CryptoCurrency } from '@ledgerhq/live-common/lib/types'
const pairsSelector = createSelector(
currenciesSelector,
@ -52,6 +54,7 @@ const addExtraPollingHooks = (schedulePoll, cancelPoll) => {
}
}
// TODO we should be able to pass-in our network() function
const CounterValues = createCounterValues({
log: (...args) => logger.log('CounterValues:', ...args),
getAPIBaseURL: () => LEDGER_COUNTERVALUES_API,
@ -61,4 +64,30 @@ const CounterValues = createCounterValues({
addExtraPollingHooks,
})
let sortCache
export const getFullListSortedCryptoCurrencies: () => Promise<CryptoCurrency[]> = () => {
if (!sortCache) {
sortCache = CounterValues.fetchTickersByMarketcap().then(
tickers => {
const list = listCryptoCurrencies().slice(0)
const prependList = []
tickers.forEach(ticker => {
const item = list.find(c => c.ticker === ticker)
if (item) {
list.splice(list.indexOf(item), 1)
prependList.push(item)
}
})
return prependList.concat(list)
},
() => {
sortCache = null // reset the cache for the next time it comes here to "try again"
return listCryptoCurrencies() // fallback on default sort
},
)
}
return sortCache
}
export default CounterValues

4
src/helpers/reset.js

@ -6,8 +6,10 @@ import resolveUserDataDirectory from 'helpers/resolveUserDataDirectory'
import { disable as disableDBMiddleware } from 'middlewares/db'
import db from 'helpers/db'
import { delay } from 'helpers/promise'
import killInternalProcess from 'commands/killInternalProcess'
function resetLibcoreDatabase() {
async function resetLibcoreDatabase() {
await killInternalProcess.send().toPromise()
const dbpath = path.resolve(resolveUserDataDirectory(), 'sqlite/')
rimraf.sync(dbpath, { glob: false })
}

2
src/reducers/settings.js

@ -70,7 +70,7 @@ const INITIAL_STATE: SettingsState = {
currenciesSettings: {},
developerMode: !!process.env.__DEV__,
loaded: false,
shareAnalytics: false,
shareAnalytics: true,
sentryLogs: true,
lastUsedVersion: __APP_VERSION__,
}

2
static/i18n/en/app.json

@ -167,7 +167,7 @@
"coinmama": "Coinmama is a financial service that makes it fast, safe and fun to buy digital assets, anywhere in the world.",
"simplex": "Simplex is a EU licensed financial institution, providing a fraudless credit card payment solution.",
"paybis": "it is safe and easy to Buy Bitcoin with credit card from PayBis. Service operates in US, Canada, Germany, Russia and Saudi Arabia.",
"luno": "Luno makes it safe and easy to buy, store and learn about digital currencies like Bitcoin and Ethreum",
"luno": "Luno makes it safe and easy to buy, store and learn about cryptocurrencies like Bitcoin and Ethereum",
"shapeshift": "ShapeShift is an online marketplace where users can buy and sell digital assets. It is a fast and secure way for the world to buy and sell digital assets, with no lengthy signup process, no counterparty risk, and no friction.",
"genesis": "Genesis is an institutional trading firm offering liquidity and borrow for digital currencies, including bitcoin, bitcoin cash, ethereum, ethereum classic, litecoin, and XRP."
},

32
test-e2e/password-lock-check.spec.js

@ -2,30 +2,32 @@ import { Application } from 'spectron'
import { waitForDisappear, waitForExpectedText } from './helpers'
const os = require('os')
const path = require('path')
const fs = require('fs')
const appVersion = require('../package.json')
let app
const TIMEOUT = 50 * 1000
let app_path
let appPath
let configPath
const platform = os.platform()
if (platform === 'darwin') {
app_path = `./dist/mac/Ledger Live.app/Contents/MacOS/Ledger Live`
configPath = `~/Library/Application Support/Ledger Live/`
appPath = `./dist/mac/Ledger Live.app/Contents/MacOS/Ledger Live`
configPath = `${os.homedir()}/Library/Application Support/Ledger Live/`
} else if (platform === 'win32') {
app_path = `.\\dist\\win-unpacked\\Ledger Live.exe`
appPath = `.\\dist\\win-unpacked\\Ledger Live.exe`
configPath = '%AppData\\Roaming\\Ledger Live'
} else {
app_path = `./dist/ledger-live-desktop-${appVersion.version}-linux-x86_64.AppImage`
appPath = `./dist/ledger-live-desktop-${appVersion.version}-linux-x86_64.AppImage`
configPath = '$HOME/apps/ledger-live-desktop-$ledgerLiveVersion-linux-x86_64.AppImage'
}
describe('Application launch', () => {
beforeEach(async () => {
app = new Application({
path: app_path,
path: appPath,
env: {
SKIP_ONBOARDING: '1',
},
@ -49,7 +51,7 @@ describe('Application launch', () => {
// Verify Account summary text
// Count user's accounts
const userAccountsList = await app.client.elements('[data-e2e=dashboard_AccountCardWrapper]')
const userAccountsCount = await Object.keys(userAccountsList.value).length
const userAccountsCount = Object.keys(userAccountsList.value).length
// Check account number
const accountSummary = await app.client.getText('[data-e2e=dashboard_accountsSummaryDesc]')
const accountSummaryMessage = `Here's the summary of your ${userAccountsCount} accounts`
@ -66,18 +68,24 @@ describe('Application launch', () => {
await app.client.setValue('[data-e2e=setPassword_ConfirmPassword]', 5)
await app.client.keys('Enter')
await waitForExpectedText(app, '[data-e2e=settings_title]', 'Settings')
await app.client.pause(2000)
// Verify in app.json that accounts data are encrypted
const tmpAppJSONPath = `${configPath} + "app.json"`
const accountsOperations = '"operations": [{'
expect(tmpAppJSONPath).not.toContain(accountsOperations)
const tmpAppJSONPath = path.resolve(configPath, 'app.json')
const LockedfileContent = fs.readFileSync(tmpAppJSONPath, 'utf-8')
const accountsOperations = '"operations":[{'
await expect(LockedfileContent).not.toContain(accountsOperations)
// Desable password lock
// Disable password lock
await app.client.click('[data-e2e=passwordLock_button]')
await waitForExpectedText(app, '[data-e2e=modal_title]', 'Disable password lock')
await app.client.setValue('#password', 5)
await app.client.pause(500)
await app.client.keys('Enter')
await waitForExpectedText(app, '[data-e2e=settings_title]', 'Settings')
await app.client.pause(3000)
const UnlockedfileContent = fs.readFileSync(tmpAppJSONPath, 'utf-8')
// Verify in app.json that accounts data are not encrypted
await expect(UnlockedfileContent).toContain(accountsOperations)
await app.client.pause(1000)
},
TIMEOUT,

6
yarn.lock

@ -1549,9 +1549,9 @@
npm "^5.7.1"
prebuild-install "^2.2.2"
"@ledgerhq/live-common@^3.5.1":
version "3.5.1"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-3.5.1.tgz#dab3eb061f361999a9e04ef564808831faac61ea"
"@ledgerhq/live-common@^3.7.1":
version "3.7.1"
resolved "https://registry.yarnpkg.com/@ledgerhq/live-common/-/live-common-3.7.1.tgz#5ce1895920d2eae6c454c2c72612dc9afd11adec"
dependencies:
axios "^0.18.0"
bignumber.js "^7.2.1"

Loading…
Cancel
Save