From a54df5a32637fbc2fa18d20be59604926cc535b8 Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Thu, 1 Nov 2018 10:26:45 +0100 Subject: [PATCH 01/10] :seedling: change storage keys --- README.md | 4 ++-- src/constants/settings.js | 4 ++-- src/store/middlewares/account.js | 6 +++--- src/store/middlewares/account.test.js | 4 ++-- src/utils/login.js | 17 +++++++++++++---- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9fae4d41b6..cec599fdf1 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ http://localhost:8080/#/?showNetwork=true If you are actively developing in a specific route, and want to be autologged in everytime you reload the page, please add the following to localStorage: ``` -localStorage.setItem('autologinUrl', 'http://localhost:4000') // desired node to log in into -localStorage.setItem('autologinKey', 'wagon stock borrow episode laundry kitten salute link globe zero feed marble') // desired account passphrase +localStorage.setItem('loginCoreUrl', 'http://localhost:4000') // desired node to log in into +localStorage.setItem('loginKey', 'wagon stock borrow episode laundry kitten salute link globe zero feed marble') // desired account passphrase ``` #### Build diff --git a/src/constants/settings.js b/src/constants/settings.js index 580cd77604..ec3bfd0b63 100644 --- a/src/constants/settings.js +++ b/src/constants/settings.js @@ -1,8 +1,8 @@ const settings = { currencies: ['USD', 'EUR'], keys: { - autologinKey: 'autologinKey', - autologinUrl: 'autologinUrl', + loginKey: 'loginKey', + loginCoreUrl: 'loginCoreUrl', }, }; export default settings; diff --git a/src/store/middlewares/account.js b/src/store/middlewares/account.js index ffb4ba8da7..71067cb01f 100644 --- a/src/store/middlewares/account.js +++ b/src/store/middlewares/account.js @@ -123,11 +123,11 @@ const autoLogInIfNecessary = (store) => { const autologinData = getAutoLogInData(); if (shouldAutoLogIn(autologinData)) { store.dispatch(activePeerSet({ - passphrase: autologinData[settings.keys.autologinKey], - network: { ...networks.customNode, address: autologinData[settings.keys.autologinUrl] }, + passphrase: autologinData[settings.keys.loginKey], + network: { ...networks.customNode, address: autologinData[settings.keys.loginCoreUrl] }, options: { code: networks.customNode.code, - address: autologinData[settings.keys.autologinUrl], + address: autologinData[settings.keys.loginCoreUrl], }, })); store.dispatch(activePeerUpdate({ diff --git a/src/store/middlewares/account.test.js b/src/store/middlewares/account.test.js index a9b96ac424..931fe817af 100644 --- a/src/store/middlewares/account.test.js +++ b/src/store/middlewares/account.test.js @@ -209,8 +209,8 @@ describe('Account middleware', () => { it(`should dispatch ${actionTypes.activePeerSet} action on ${actionTypes.storeCreated} if autologin data found in localStorage`, () => { getAutoLogInDataMock.withArgs().returns({ - [settings.keys.autologinKey]: passphrase, - [settings.keys.autologinUrl]: networks.testnet.nodes[0], + [settings.keys.loginKey]: passphrase, + [settings.keys.loginCoreUrl]: networks.testnet.nodes[0], }); middleware(store)(next)(storeCreatedAction); expect(store.dispatch).to.have.been.calledWith(activePeerMock); diff --git a/src/utils/login.js b/src/utils/login.js index 03b7f1dba8..f351c3b3cf 100644 --- a/src/utils/login.js +++ b/src/utils/login.js @@ -1,5 +1,6 @@ import i18next from 'i18next'; import settings from './../constants/settings'; +import networks from './../constants/networks'; // https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url // eslint-disable-next-line no-useless-escape @@ -35,10 +36,18 @@ export const validateUrl = (value) => { export const getAutoLogInData = () => ({ - [settings.keys.autologinKey]: localStorage.getItem(settings.keys.autologinKey), - [settings.keys.autologinUrl]: localStorage.getItem(settings.keys.autologinUrl), + [settings.keys.loginKey]: localStorage.getItem(settings.keys.loginKey), + [settings.keys.loginCoreUrl]: localStorage.getItem(settings.keys.loginCoreUrl), }); export const shouldAutoLogIn = autologin => - autologin[settings.keys.autologinUrl] && autologin[settings.keys.autologinUrl] !== '' && - autologin[settings.keys.autologinKey] && autologin[settings.keys.autologinKey] !== ''; + autologin[settings.keys.loginCoreUrl] && autologin[settings.keys.loginCoreUrl] !== '' && + autologin[settings.keys.loginKey] && autologin[settings.keys.loginKey] !== ''; + +export const findMatchingLoginNetwork = () => { + const { loginUrl } = getAutoLogInData(); + return Object.entries(networks).find((network) => { + const { nodes } = network.slice(-1).shift(); + return Array.isArray(nodes) ? nodes.includes(loginUrl) : false; + }); +}; From 1d972362663c648434db9c10cc2a328cb27f8bfe Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Thu, 1 Nov 2018 10:43:00 +0100 Subject: [PATCH 02/10] :house: change localStorage key to liskCoreUrl --- README.md | 2 +- src/constants/settings.js | 2 +- src/store/middlewares/account.js | 4 ++-- src/store/middlewares/account.test.js | 2 +- src/utils/login.js | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index cec599fdf1..3aa82d08fd 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ http://localhost:8080/#/?showNetwork=true If you are actively developing in a specific route, and want to be autologged in everytime you reload the page, please add the following to localStorage: ``` -localStorage.setItem('loginCoreUrl', 'http://localhost:4000') // desired node to log in into +localStorage.setItem('liskCoreUrl', 'http://localhost:4000') // desired node to log in into localStorage.setItem('loginKey', 'wagon stock borrow episode laundry kitten salute link globe zero feed marble') // desired account passphrase ``` diff --git a/src/constants/settings.js b/src/constants/settings.js index ec3bfd0b63..1c8e536b85 100644 --- a/src/constants/settings.js +++ b/src/constants/settings.js @@ -2,7 +2,7 @@ const settings = { currencies: ['USD', 'EUR'], keys: { loginKey: 'loginKey', - loginCoreUrl: 'loginCoreUrl', + liskCoreUrl: 'liskCoreUrl', }, }; export default settings; diff --git a/src/store/middlewares/account.js b/src/store/middlewares/account.js index 71067cb01f..ac1a3c016c 100644 --- a/src/store/middlewares/account.js +++ b/src/store/middlewares/account.js @@ -124,10 +124,10 @@ const autoLogInIfNecessary = (store) => { if (shouldAutoLogIn(autologinData)) { store.dispatch(activePeerSet({ passphrase: autologinData[settings.keys.loginKey], - network: { ...networks.customNode, address: autologinData[settings.keys.loginCoreUrl] }, + network: { ...networks.customNode, address: autologinData[settings.keys.liskCoreUrl] }, options: { code: networks.customNode.code, - address: autologinData[settings.keys.loginCoreUrl], + address: autologinData[settings.keys.liskCoreUrl], }, })); store.dispatch(activePeerUpdate({ diff --git a/src/store/middlewares/account.test.js b/src/store/middlewares/account.test.js index 931fe817af..90cc7a6b96 100644 --- a/src/store/middlewares/account.test.js +++ b/src/store/middlewares/account.test.js @@ -210,7 +210,7 @@ describe('Account middleware', () => { it(`should dispatch ${actionTypes.activePeerSet} action on ${actionTypes.storeCreated} if autologin data found in localStorage`, () => { getAutoLogInDataMock.withArgs().returns({ [settings.keys.loginKey]: passphrase, - [settings.keys.loginCoreUrl]: networks.testnet.nodes[0], + [settings.keys.liskCoreUrl]: networks.testnet.nodes[0], }); middleware(store)(next)(storeCreatedAction); expect(store.dispatch).to.have.been.calledWith(activePeerMock); diff --git a/src/utils/login.js b/src/utils/login.js index f351c3b3cf..ca14ec64a2 100644 --- a/src/utils/login.js +++ b/src/utils/login.js @@ -37,11 +37,11 @@ export const validateUrl = (value) => { export const getAutoLogInData = () => ({ [settings.keys.loginKey]: localStorage.getItem(settings.keys.loginKey), - [settings.keys.loginCoreUrl]: localStorage.getItem(settings.keys.loginCoreUrl), + [settings.keys.liskCoreUrl]: localStorage.getItem(settings.keys.liskCoreUrl), }); export const shouldAutoLogIn = autologin => - autologin[settings.keys.loginCoreUrl] && autologin[settings.keys.loginCoreUrl] !== '' && + autologin[settings.keys.liskCoreUrl] && autologin[settings.keys.liskCoreUrl] !== '' && autologin[settings.keys.loginKey] && autologin[settings.keys.loginKey] !== ''; export const findMatchingLoginNetwork = () => { From 1c70b3cefde33fe71e267c92407d418aede3afcc Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Thu, 1 Nov 2018 11:00:57 +0100 Subject: [PATCH 03/10] :house: get url from localStorage and send it to activePeerSet networks --- src/components/login/login.js | 22 +++++++++++++++++++--- src/store/middlewares/peers.js | 18 +++++++++++++++--- src/utils/login.js | 4 ++-- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/components/login/login.js b/src/components/login/login.js index 2bd12800b3..ce164be421 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -15,7 +15,8 @@ import { parseSearchParams } from './../../utils/searchParams'; import Box from '../box'; // eslint-disable-next-line import/no-unresolved import SignUp from './signUp'; -import { validateUrl, addHttp } from '../../utils/login'; +import { validateUrl, addHttp, getAutoLogInData, findMatchingLoginNetwork } from '../../utils/login'; +import settings from '../../constants/settings'; /** * The container component containing login @@ -25,10 +26,23 @@ class Login extends React.Component { constructor(props) { super(props); + const { liskCoreUrl } = getAutoLogInData(); + + let loginNetwork = findMatchingLoginNetwork(); + + let address = ''; + + if (loginNetwork) { + loginNetwork = loginNetwork.slice(-1).shift(); + } else if (!loginNetwork) { + loginNetwork = liskCoreUrl ? networks.customNode : networks.default; + address = liskCoreUrl; + } + this.state = { passphrase: '', - address: '', - network: networks.default.code, + address, + network: loginNetwork.code, }; this.secondIteration = false; @@ -90,6 +104,8 @@ class Login extends React.Component { onLoginSubmission(passphrase) { const network = this.getNetwork(); + const address = network.address || network.nodes[0]; + window.localStorage.setItem(settings.keys.liskCoreUrl, address); this.secondIteration = true; if (this.alreadyLoggedWithThisAddress(extractAddress(passphrase), network)) { this.redirectToReferrer(); diff --git a/src/store/middlewares/peers.js b/src/store/middlewares/peers.js index 1ac72a4065..2a1983e07b 100644 --- a/src/store/middlewares/peers.js +++ b/src/store/middlewares/peers.js @@ -2,13 +2,25 @@ import { activePeerSet, activePeerUpdate } from '../../actions/peers'; import actionTypes from '../../constants/actions'; import networks from './../../constants/networks'; import getNetwork from './../../utils/getNetwork'; -import { shouldAutoLogIn, getAutoLogInData } from './../../utils/login'; +import { shouldAutoLogIn, getAutoLogInData, findMatchingLoginNetwork } from './../../utils/login'; const peersMiddleware = store => next => (action) => { next(action); - const network = Object.assign({}, getNetwork(networks.mainnet.code)); const autologinData = getAutoLogInData(); + const { liskCoreUrl } = autologinData; + + let loginNetwork = findMatchingLoginNetwork(); + + // if cant find login network but liskCoreUrl is set then is custom node + // else default network + if (loginNetwork) { + loginNetwork = loginNetwork.slice(-1).shift(); + } else if (!loginNetwork) { + loginNetwork = liskCoreUrl ? networks.customNode : networks.default; + } + + const network = Object.assign({}, getNetwork(loginNetwork.code)); switch (action.type) { case actionTypes.storeCreated: @@ -25,4 +37,4 @@ const peersMiddleware = store => next => (action) => { } }; -export default peersMiddleware; +export default peersMiddleware; \ No newline at end of file diff --git a/src/utils/login.js b/src/utils/login.js index ca14ec64a2..e8330546bb 100644 --- a/src/utils/login.js +++ b/src/utils/login.js @@ -45,9 +45,9 @@ export const shouldAutoLogIn = autologin => autologin[settings.keys.loginKey] && autologin[settings.keys.loginKey] !== ''; export const findMatchingLoginNetwork = () => { - const { loginUrl } = getAutoLogInData(); + const { liskCoreUrl } = getAutoLogInData(); return Object.entries(networks).find((network) => { const { nodes } = network.slice(-1).shift(); - return Array.isArray(nodes) ? nodes.includes(loginUrl) : false; + return Array.isArray(nodes) ? nodes.includes(liskCoreUrl) : false; }); }; From ea82b7f75a9d5d90a70ae3512041e25fc58fa184 Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Thu, 1 Nov 2018 11:19:48 +0100 Subject: [PATCH 04/10] :nail_care: add new line --- src/store/middlewares/peers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/middlewares/peers.js b/src/store/middlewares/peers.js index 2a1983e07b..eede43c35e 100644 --- a/src/store/middlewares/peers.js +++ b/src/store/middlewares/peers.js @@ -37,4 +37,4 @@ const peersMiddleware = store => next => (action) => { } }; -export default peersMiddleware; \ No newline at end of file +export default peersMiddleware; From bf7be0040104dbdd7b1a069ad9e83529de6b6c4c Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Fri, 2 Nov 2018 09:15:53 +0100 Subject: [PATCH 05/10] :house: only save network on success login --- src/actions/peers.js | 5 +++++ src/components/login/login.js | 3 --- src/store/middlewares/peers.js | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/actions/peers.js b/src/actions/peers.js index be230625be..7b00b30db1 100644 --- a/src/actions/peers.js +++ b/src/actions/peers.js @@ -9,6 +9,7 @@ import { getAccount } from '../utils/api/account'; import { extractAddress, extractPublicKey } from '../utils/account'; import { accountLoggedIn, accountLoading, accountLoggedOut } from './account'; import accountConfig from '../constants/account'; +import settings from '../constants/settings'; const peerSet = (data, config) => ({ data: Object.assign({ @@ -49,6 +50,10 @@ const login = (dispatch, getState, data, config) => { ...accountBasics, expireTime: duration, }; + /* Save selected network to localStorage */ + const networkAddress = data.network.address ? data.network.address : data.network.nodes[0]; + window.localStorage.setItem(settings.keys.liskCoreUrl, networkAddress); + dispatch(accountLoggedIn(accountUpdated)); }).catch((error) => { if (error && error.message) { diff --git a/src/components/login/login.js b/src/components/login/login.js index ce164be421..8a0a63b75a 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -16,7 +16,6 @@ import Box from '../box'; // eslint-disable-next-line import/no-unresolved import SignUp from './signUp'; import { validateUrl, addHttp, getAutoLogInData, findMatchingLoginNetwork } from '../../utils/login'; -import settings from '../../constants/settings'; /** * The container component containing login @@ -104,8 +103,6 @@ class Login extends React.Component { onLoginSubmission(passphrase) { const network = this.getNetwork(); - const address = network.address || network.nodes[0]; - window.localStorage.setItem(settings.keys.liskCoreUrl, address); this.secondIteration = true; if (this.alreadyLoggedWithThisAddress(extractAddress(passphrase), network)) { this.redirectToReferrer(); diff --git a/src/store/middlewares/peers.js b/src/store/middlewares/peers.js index eede43c35e..f9a9601935 100644 --- a/src/store/middlewares/peers.js +++ b/src/store/middlewares/peers.js @@ -14,6 +14,7 @@ const peersMiddleware = store => next => (action) => { // if cant find login network but liskCoreUrl is set then is custom node // else default network + /* istanbul ignore next */ if (loginNetwork) { loginNetwork = loginNetwork.slice(-1).shift(); } else if (!loginNetwork) { From b00ff801535e8e4ddc3861519e90d24f70742bf5 Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Fri, 2 Nov 2018 09:18:31 +0100 Subject: [PATCH 06/10] :nail_care: remove spaces --- src/actions/peers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions/peers.js b/src/actions/peers.js index 7b00b30db1..3c713da487 100644 --- a/src/actions/peers.js +++ b/src/actions/peers.js @@ -53,7 +53,7 @@ const login = (dispatch, getState, data, config) => { /* Save selected network to localStorage */ const networkAddress = data.network.address ? data.network.address : data.network.nodes[0]; window.localStorage.setItem(settings.keys.liskCoreUrl, networkAddress); - + dispatch(accountLoggedIn(accountUpdated)); }).catch((error) => { if (error && error.message) { From 5e4f36ac7ddc5eafecb2379c3604e59eacef16c8 Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Fri, 2 Nov 2018 10:25:16 +0100 Subject: [PATCH 07/10] :white_check_mark: added tests for no selected network --- src/store/middlewares/peers.js | 1 - src/store/middlewares/peers.test.js | 39 ++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/store/middlewares/peers.js b/src/store/middlewares/peers.js index f9a9601935..eede43c35e 100644 --- a/src/store/middlewares/peers.js +++ b/src/store/middlewares/peers.js @@ -14,7 +14,6 @@ const peersMiddleware = store => next => (action) => { // if cant find login network but liskCoreUrl is set then is custom node // else default network - /* istanbul ignore next */ if (loginNetwork) { loginNetwork = loginNetwork.slice(-1).shift(); } else if (!loginNetwork) { diff --git a/src/store/middlewares/peers.test.js b/src/store/middlewares/peers.test.js index 2b410cd9d1..33f70b7872 100644 --- a/src/store/middlewares/peers.test.js +++ b/src/store/middlewares/peers.test.js @@ -3,16 +3,21 @@ import { spy, stub } from 'sinon'; import middleware from './peers'; import actionTypes from '../../constants/actions'; import { activePeerSet } from '../../actions/peers'; +import * as loginUtils from './../../utils/login'; describe('Peer middleware', () => { let store; let next; let localStorageStub; + let loginUtilsStub; + let getAutoLogInDataStub; beforeEach(() => { next = spy(); store = stub(); localStorageStub = stub(localStorage, 'get'); + loginUtilsStub = stub(loginUtils, 'findMatchingLoginNetwork'); + getAutoLogInDataStub = stub(loginUtils, 'getAutoLogInData'); store.getState = () => ({ peers: { @@ -25,11 +30,15 @@ describe('Peer middleware', () => { afterEach(() => { localStorageStub.restore(); + loginUtilsStub.restore(); + getAutoLogInDataStub.restore(); }); it('should just pass action along', () => { localStorageStub.returns(JSON.stringify([])); - + getAutoLogInDataStub.returns({ + liskCoreUrl: 'https://testnet.lisk.io', + }); const sampleAction = { type: 'SAMPLE_TYPE', data: 'SAMPLE_DATA', @@ -38,9 +47,34 @@ describe('Peer middleware', () => { expect(next).to.have.been.calledWith(sampleAction); }); + it('should get the correct network', () => { + getAutoLogInDataStub.returns({ + liskCoreUrl: 'https://testnet.lisk.io', + }); + loginUtilsStub.returns(); + const storeCreated = { type: actionTypes.storeCreated }; + localStorageStub.returns(JSON.stringify([])); + middleware(store)(next)(storeCreated); + expect(store.dispatch).to.have.been.calledWith(); + }); + + it('should auto login without shouldAutoLogIn', () => { + getAutoLogInDataStub.returns({ + liskCoreUrl: undefined, + }); + loginUtilsStub.returns(); + const storeCreated = { type: actionTypes.storeCreated }; + localStorageStub.returns(JSON.stringify([])); + middleware(store)(next)(storeCreated); + expect(store.dispatch).to.have.been.calledWith(); + }); + it('should dispatch activePeerSet if there are no saved accounts', () => { const storeCreated = { type: actionTypes.storeCreated }; localStorageStub.returns(JSON.stringify([])); + getAutoLogInDataStub.returns({ + liskCoreUrl: 'https://testnet.lisk.io', + }); middleware(store)(next)(storeCreated); expect(store.dispatch).to.have.been.calledWith(); }); @@ -48,6 +82,9 @@ describe('Peer middleware', () => { it('should not dispatch activePeerSet if there are saved accounts', () => { const storeCreated = { type: actionTypes.storeCreated }; localStorageStub.returns(JSON.stringify([{}, {}])); + getAutoLogInDataStub.returns({ + liskCoreUrl: 'https://testnet.lisk.io', + }); middleware(store)(next)(storeCreated); expect(store.dispatch).to.not.have.been.calledWith(activePeerSet()); }); From efb660dbf024988e87dfb7f43063efe36742d87e Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Fri, 2 Nov 2018 14:19:25 +0100 Subject: [PATCH 08/10] :nail_care: fix localStorage key in e2e --- test/cypress/support/commands.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 4801ca2efe..9d3fc8b342 100644 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -36,8 +36,8 @@ Cypress.Commands.add('addLocalStorage', (item, key, value) => { }); Cypress.Commands.add('autologin', (passphrase, network) => { - localStorage.setItem('autologinUrl', network); - localStorage.setItem('autologinKey', passphrase); + localStorage.setItem('liskCoreUrl', network); + localStorage.setItem('loginKey', passphrase); }); From 6ef8bce2623bd96b55b77d46104196550fcb359b Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Fri, 2 Nov 2018 14:45:32 +0100 Subject: [PATCH 09/10] :white_check_mark: change chars to 18 --- test/cypress/e2e/txDetails.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/cypress/e2e/txDetails.spec.js b/test/cypress/e2e/txDetails.spec.js index a430217a0a..9211e798f8 100644 --- a/test/cypress/e2e/txDetails.spec.js +++ b/test/cypress/e2e/txDetails.spec.js @@ -44,7 +44,7 @@ describe('Tx details', () => { cy.get(ss.txAmount).should('have.text', '-5'); cy.get(ss.txFee).should('have.text', '0.1'); cy.get(ss.txConfirmations).should('have.text', ''); - cy.get(ss.txId).contains(/^\d{19}/); + cy.get(ss.txId).contains(/^\d{18}/); cy.get(ss.txReference).should('have.text', 'test-details'); // After confirmation cy.get(ss.txDate, { timeout: txConfirmationTimeout }).contains(new Date().getFullYear()); @@ -62,7 +62,7 @@ describe('Tx details', () => { cy.get(ss.txRemovedVotes).should('not.exist'); cy.get(ss.txFee).should('have.text', '1'); cy.get(ss.txConfirmations).contains(/^\d/); - cy.get(ss.txId).contains(/^\d{19}/); + cy.get(ss.txId).contains(/^\d{18}/); cy.get(ss.txReference).should('have.text', '-'); }); @@ -80,7 +80,7 @@ describe('Tx details', () => { cy.get(ss.txRemovedVotes).should('not.exist'); // cy.get(ss.txFee).should('have.text', '25'); cy.get(ss.txConfirmations).contains(/^\d/); - cy.get(ss.txId).contains(/^\d{19}/); + cy.get(ss.txId).contains(/^\d{18}/); cy.get(ss.txReference).should('have.text', '-'); }); @@ -95,7 +95,7 @@ describe('Tx details', () => { cy.get(ss.txRemovedVotes).should('not.exist'); cy.get(ss.txFee).should('have.text', '5'); cy.get(ss.txConfirmations).contains(/^\d/); - cy.get(ss.txId).contains(/^\d{19}/); + cy.get(ss.txId).contains(/^\d{18}/); cy.get(ss.txReference).should('have.text', '-'); }); }); From 9926bde53725fd406ad030458baee8c364a1c220 Mon Sep 17 00:00:00 2001 From: Benjamin Maggi Date: Fri, 2 Nov 2018 14:50:36 +0100 Subject: [PATCH 10/10] :white_check_mark: change chars to 1,20 --- test/cypress/e2e/txDetails.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/cypress/e2e/txDetails.spec.js b/test/cypress/e2e/txDetails.spec.js index 9211e798f8..58290bddf4 100644 --- a/test/cypress/e2e/txDetails.spec.js +++ b/test/cypress/e2e/txDetails.spec.js @@ -44,7 +44,7 @@ describe('Tx details', () => { cy.get(ss.txAmount).should('have.text', '-5'); cy.get(ss.txFee).should('have.text', '0.1'); cy.get(ss.txConfirmations).should('have.text', ''); - cy.get(ss.txId).contains(/^\d{18}/); + cy.get(ss.txId).contains(/^\d{1,20}/); cy.get(ss.txReference).should('have.text', 'test-details'); // After confirmation cy.get(ss.txDate, { timeout: txConfirmationTimeout }).contains(new Date().getFullYear()); @@ -62,7 +62,7 @@ describe('Tx details', () => { cy.get(ss.txRemovedVotes).should('not.exist'); cy.get(ss.txFee).should('have.text', '1'); cy.get(ss.txConfirmations).contains(/^\d/); - cy.get(ss.txId).contains(/^\d{18}/); + cy.get(ss.txId).contains(/^\d{1,20}/); cy.get(ss.txReference).should('have.text', '-'); }); @@ -80,7 +80,7 @@ describe('Tx details', () => { cy.get(ss.txRemovedVotes).should('not.exist'); // cy.get(ss.txFee).should('have.text', '25'); cy.get(ss.txConfirmations).contains(/^\d/); - cy.get(ss.txId).contains(/^\d{18}/); + cy.get(ss.txId).contains(/^\d{1,20}/); cy.get(ss.txReference).should('have.text', '-'); }); @@ -95,7 +95,7 @@ describe('Tx details', () => { cy.get(ss.txRemovedVotes).should('not.exist'); cy.get(ss.txFee).should('have.text', '5'); cy.get(ss.txConfirmations).contains(/^\d/); - cy.get(ss.txId).contains(/^\d{18}/); + cy.get(ss.txId).contains(/^\d{1,20}/); cy.get(ss.txReference).should('have.text', '-'); }); });