From 5d74c1765caa5bcff1eb0749ab6ef62aee2eedca Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 25 Dec 2018 18:49:26 +0300 Subject: [PATCH 1/6] Reorder method executors: owners are first --- .../send/choose-contract-executor.js | 99 ++++++++++++++++--- 1 file changed, 88 insertions(+), 11 deletions(-) diff --git a/old-ui/app/components/send/choose-contract-executor.js b/old-ui/app/components/send/choose-contract-executor.js index 53d75204622d..abf5ade83d21 100644 --- a/old-ui/app/components/send/choose-contract-executor.js +++ b/old-ui/app/components/send/choose-contract-executor.js @@ -7,13 +7,46 @@ import SendHeader from './send-header' import SendError from './send-error' import actions from '../../../../ui/app/actions' import { ifContractAcc } from '../../util' +import Web3 from 'web3' + +const ownerABI = [{ + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "type": "function", + "stateMutability": "view" +}] + +const getOwnersABI = [{ + "constant": true, + "inputs": [], + "name": "getOwners", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "type": "function", + "stateMutability": "view" +}] class ChooseContractExecutor extends Component { constructor (props) { super(props) this.state = { + web3: new Web3(global.ethereumProvider), selectedExecutor: '', accountsCells: [], + owners: [], nextDisabled: true, } } @@ -61,7 +94,8 @@ class ChooseContractExecutor extends Component { ) } - componentDidMount () { + componentDidMount = async () => { + await this.getAllOwners() this.generateListOfAccounts() } @@ -88,22 +122,25 @@ class ChooseContractExecutor extends Component { return buttonContainer } - generateListOfAccounts () { + generateListOfAccounts = () => { const { keyrings, identities } = this.props const accountsCells = [] keyrings.forEach((keyring) => { if (!ifContractAcc(keyring)) { keyring.accounts.forEach((address) => { const identity = identities[address] - accountsCells.push( - this.selectExecutor(e, isSelected, address)} - /> - ) + const executorCell = this.selectExecutor(e, isSelected, address)} + /> + if (this.state.owners.includes(address)) { + accountsCells.unshift(executorCell) + } else { + accountsCells.push(executorCell) + } }) } }) @@ -113,6 +150,44 @@ class ChooseContractExecutor extends Component { }) } + getAllOwners = () => { + this.props.showLoadingIndication() + return new Promise((resolve) => { + Promise.all([this.getOwner(), this.getOwners()]) + .then(([owner, owners]) => { + if (owner !== '0x' && !owners.includes(owner)) { + owners.push(owner) + } + this.setState({ owners }) + this.props.hideLoadingIndication() + resolve() + }) + }) + } + + getOwner = () => { + return this.getOwnersCommon('owner', ownerABI) + } + + getOwners = () => { + return this.getOwnersCommon('getOwners', getOwnersABI) + } + + getOwnersCommon = (method, abi) => { + const { web3 } = this.state + const { txParams } = this.props + + return new Promise((resolve) => { + try { + web3.eth.contract(abi).at(txParams.to)[method].call((err, output) => { + resolve(output) + }) + } catch (e) { + resolve('') + } + }) + } + componentDidUpdate (prevProps, prevState) { if (prevState.selectedExecutor !== this.state.selectedExecutor) { this.generateListOfAccounts() @@ -170,6 +245,8 @@ function mapStateToProps (state) { function mapDispatchToProps (dispatch) { return { + showLoadingIndication: () => dispatch(actions.showLoadingIndication()), + hideLoadingIndication: () => dispatch(actions.hideLoadingIndication()), hideWarning: () => dispatch(actions.hideWarning()), signTx: (txParams) => dispatch(actions.signTx(txParams)), setSelectedAddress: (address) => dispatch(actions.setSelectedAddress(address)), From f3dd598110f06170ef1c1c72f092d2cd5a4407b9 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 25 Dec 2018 19:33:58 +0300 Subject: [PATCH 2/6] eslinter, unit tests fixes --- .../send/choose-contract-executor.js | 42 ++++++++++--------- .../send/choose-contract-executor.spec.js | 10 ++++- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/old-ui/app/components/send/choose-contract-executor.js b/old-ui/app/components/send/choose-contract-executor.js index abf5ade83d21..f74b89e615da 100644 --- a/old-ui/app/components/send/choose-contract-executor.js +++ b/old-ui/app/components/send/choose-contract-executor.js @@ -10,33 +10,33 @@ import { ifContractAcc } from '../../util' import Web3 from 'web3' const ownerABI = [{ - "constant": true, - "inputs": [], - "name": "owner", - "outputs": [ + 'constant': true, + 'inputs': [], + 'name': 'owner', + 'outputs': [ { - "name": "", - "type": "address" - } + 'name': '', + 'type': 'address', + }, ], - "payable": false, - "type": "function", - "stateMutability": "view" + 'payable': false, + 'type': 'function', + 'stateMutability': 'view', }] const getOwnersABI = [{ - "constant": true, - "inputs": [], - "name": "getOwners", - "outputs": [ + 'constant': true, + 'inputs': [], + 'name': 'getOwners', + 'outputs': [ { - "name": "", - "type": "address[]" - } + 'name': '', + 'type': 'address[]', + }, ], - "payable": false, - "type": "function", - "stateMutability": "view" + 'payable': false, + 'type': 'function', + 'stateMutability': 'view', }] class ChooseContractExecutor extends Component { @@ -63,6 +63,8 @@ class ChooseContractExecutor extends Component { identities: PropTypes.object, keyrings: PropTypes.array, error: PropTypes.string, + showLoadingIndication: PropTypes.func, + hideLoadingIndication: PropTypes.func, } render () { diff --git a/test/unit/old-ui/app/components/send/choose-contract-executor.spec.js b/test/unit/old-ui/app/components/send/choose-contract-executor.spec.js index 35a8f11cb16c..2ade7f2c6a50 100644 --- a/test/unit/old-ui/app/components/send/choose-contract-executor.spec.js +++ b/test/unit/old-ui/app/components/send/choose-contract-executor.spec.js @@ -73,8 +73,14 @@ describe('ChooseContractExecutor component', () => { assert.equal(wrapper.find('.choose-contract-next-button').text(), 'Next') }) - it('the number of accounts is equal to number of keyrings', () => { - assert.equal(wrapper.find('.executor-cell-container').length, state.metamask.keyrings.length) + it('the number of accounts is equal to number of keyrings', async () => { + return new Promise(resolve => { + setTimeout(() => { + wrapper.update() + assert.equal(wrapper.find('.executor-cell-container').length, state.metamask.keyrings.length) + resolve() + }, 500) + }) }) }) }) From 291089de42b0768665a54f8894d791765cc1c015 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 26 Dec 2018 18:23:18 +0300 Subject: [PATCH 3/6] empty owners var fix --- .../send/choose-contract-executor.js | 3 + package-lock.json | 113 +++++++++--------- 2 files changed, 59 insertions(+), 57 deletions(-) diff --git a/old-ui/app/components/send/choose-contract-executor.js b/old-ui/app/components/send/choose-contract-executor.js index f74b89e615da..c3faf7df70ea 100644 --- a/old-ui/app/components/send/choose-contract-executor.js +++ b/old-ui/app/components/send/choose-contract-executor.js @@ -157,6 +157,9 @@ class ChooseContractExecutor extends Component { return new Promise((resolve) => { Promise.all([this.getOwner(), this.getOwners()]) .then(([owner, owners]) => { + if (!owners) { + owners = [] + } if (owner !== '0x' && !owners.includes(owner)) { owners.push(owner) } diff --git a/package-lock.json b/package-lock.json index 0cc5421dcd1f..b6c84a5b1e13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3505,7 +3505,7 @@ }, "array-flatten": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, "array-from": { @@ -5462,7 +5462,7 @@ }, "brfs": { "version": "1.6.1", - "resolved": "http://registry.npmjs.org/brfs/-/brfs-1.6.1.tgz", + "resolved": "https://registry.npmjs.org/brfs/-/brfs-1.6.1.tgz", "integrity": "sha512-OfZpABRQQf+Xsmju8XE9bDjs+uU4vLREGolP7bDgcpsI17QREyZ4Bl+2KLxxx1kCgA0fAIhKQBaBYh+PEcCqYQ==", "dev": true, "requires": { @@ -5546,7 +5546,7 @@ "dependencies": { "resolve": { "version": "1.1.7", - "resolved": "http://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", "dev": true } @@ -6828,7 +6828,7 @@ }, "color-string": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/color-string/-/color-string-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-0.3.0.tgz", "integrity": "sha1-J9RvtnAlxcL6JZk7+/V55HhBuZE=", "requires": { "color-name": "^1.0.0" @@ -7169,7 +7169,7 @@ }, "content-disposition": { "version": "0.5.2", - "resolved": "http://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" }, "content-type": { @@ -7572,7 +7572,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, @@ -7652,7 +7652,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true } @@ -8147,7 +8147,7 @@ }, "deps-sort": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", "dev": true, "requires": { @@ -8780,7 +8780,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, @@ -10104,7 +10104,7 @@ } }, "eth-contract-metadata": { - "version": "github:MetaMask/eth-contract-metadata#889defeaaa18e5488f2695a462d22a29936229e2", + "version": "github:MetaMask/eth-contract-metadata#05e39ee1be2edaa53b04ff7e215cdd6db16d09c1", "from": "github:MetaMask/eth-contract-metadata#master" }, "eth-ens-namehash": { @@ -10124,9 +10124,8 @@ } }, "eth-hd-keyring": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eth-hd-keyring/-/eth-hd-keyring-2.0.0.tgz", - "integrity": "sha512-lTeANNPNj/j08sWU7LUQZTsx9NUJaUsiOdVxeP0UI5kke7L+Sd7zJWBmCShudEVG8PkqKLE1KJo08o430sl6rw==", + "version": "https://registry.npmjs.org/eth-hd-keyring/-/eth-hd-keyring-2.0.0.tgz", + "from": "eth-hd-keyring@2.0.0", "requires": { "bip39": "^2.2.0", "eth-sig-util": "^2.0.1", @@ -10445,13 +10444,13 @@ } }, "eth-keychain-controller": { - "version": "github:vbaranov/KeyringController#541efb780cf59bbb1d0b6ed1d6dbe30cafe82e06", + "version": "github:vbaranov/KeyringController#52961c8fac58177c9b39ec7754de3ecda90e8a08", "from": "github:vbaranov/KeyringController#simple-address", "requires": { "bip39": "^2.4.0", "bluebird": "^3.5.0", "browser-passworder": "^2.0.3", - "eth-hd-keyring": "^2.0.0", + "eth-hd-keyring": "https://registry.npmjs.org/eth-hd-keyring/-/eth-hd-keyring-2.0.0.tgz", "eth-sig-util": "^1.4.0", "eth-simple-keyring": "^2.0.0", "ethereumjs-util": "^5.1.2", @@ -11991,7 +11990,7 @@ }, "expand-range": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-0.1.1.tgz", "integrity": "sha1-TLjtoJk8pW+k9B/ELzy7TMrf8EQ=", "dev": true, "requires": { @@ -12023,7 +12022,7 @@ }, "expand-range": { "version": "1.8.2", - "resolved": "http://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", "requires": { "fill-range": "^2.1.0" @@ -14238,7 +14237,7 @@ }, "array-flatten": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=", "dev": true }, @@ -16218,7 +16217,7 @@ }, "ethereumjs-vm": { "version": "2.3.4", - "resolved": "http://registry.npmjs.org/ethereumjs-vm/-/ethereumjs-vm-2.3.4.tgz", + "resolved": "https://registry.npmjs.org/ethereumjs-vm/-/ethereumjs-vm-2.3.4.tgz", "integrity": "sha512-Y4SlzNDqxrCO58jhp98HdnZVdjOqB+HC0hoU+N/DEp1aU+hFkRX/nru5F7/HkQRPIlA6aJlQp/xIA6xZs1kspw==", "dev": true, "requires": { @@ -17587,7 +17586,7 @@ }, "lru-cache": { "version": "3.2.0", - "resolved": "http://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz", "integrity": "sha1-cXibO39Tmb7IVl3aOKow0qCX7+4=", "dev": true, "requires": { @@ -18385,7 +18384,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -18419,7 +18418,7 @@ }, "regexpu-core": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", "dev": true, "requires": { @@ -18436,7 +18435,7 @@ }, "regjsparser": { "version": "0.1.5", - "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "dev": true, "requires": { @@ -18500,7 +18499,7 @@ }, "resolve": { "version": "1.7.1", - "resolved": "http://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", "dev": true, "requires": { @@ -18912,7 +18911,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, @@ -19265,7 +19264,7 @@ }, "underscore": { "version": "1.8.3", - "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, @@ -24851,7 +24850,7 @@ }, "stream-combiner": { "version": "0.2.2", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.2.2.tgz", "integrity": "sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg=", "dev": true, "requires": { @@ -24861,7 +24860,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, @@ -25078,7 +25077,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true } @@ -25535,7 +25534,7 @@ }, "karma-cli": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/karma-cli/-/karma-cli-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/karma-cli/-/karma-cli-1.0.1.tgz", "integrity": "sha1-rmw8WKMTodALRRZMRVubhs4X+WA=", "dev": true, "requires": { @@ -25713,7 +25712,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, @@ -25785,7 +25784,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" } } @@ -25822,7 +25821,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" }, "xtend": { @@ -26596,7 +26595,7 @@ }, "map-stream": { "version": "0.1.0", - "resolved": "http://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", "dev": true }, @@ -27672,7 +27671,7 @@ "dependencies": { "detective": { "version": "5.1.0", - "resolved": "http://registry.npmjs.org/detective/-/detective-5.1.0.tgz", + "resolved": "https://registry.npmjs.org/detective/-/detective-5.1.0.tgz", "integrity": "sha512-TFHMqfOvxlgrfVzTEkNBSh9SvSNX/HfF4OFI2QFGCyPm02EsyILqnUeb5P6q7JZ3SFNTBL5t2sePRgrN4epUWQ==", "dev": true, "requires": { @@ -27763,7 +27762,7 @@ }, "multimatch": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-2.1.0.tgz", "integrity": "sha1-nHkGoi+0wCkZ4vX3UWG0zb1LKis=", "dev": true, "requires": { @@ -27775,7 +27774,7 @@ }, "multipipe": { "version": "0.1.2", - "resolved": "http://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", "dev": true, "requires": { @@ -30278,7 +30277,7 @@ }, "path-browserify": { "version": "0.0.0", - "resolved": "http://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=" }, "path-dirname": { @@ -32676,7 +32675,7 @@ }, "global-modules": { "version": "0.2.3", - "resolved": "http://registry.npmjs.org/global-modules/-/global-modules-0.2.3.tgz", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-0.2.3.tgz", "integrity": "sha1-6lo77ULG1s6ZWk+KEmm12uIjgo0=", "dev": true, "requires": { @@ -32686,7 +32685,7 @@ }, "global-prefix": { "version": "0.1.5", - "resolved": "http://registry.npmjs.org/global-prefix/-/global-prefix-0.1.5.tgz", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-0.1.5.tgz", "integrity": "sha1-jTvGuNo8qBEqFg2NSW/wRiv+948=", "dev": true, "requires": { @@ -32713,7 +32712,7 @@ }, "resolve-dir": { "version": "0.1.1", - "resolved": "http://registry.npmjs.org/resolve-dir/-/resolve-dir-0.1.1.tgz", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-0.1.1.tgz", "integrity": "sha1-shklmlYC+sXFxJatiUpujMQwJh4=", "dev": true, "requires": { @@ -33791,7 +33790,7 @@ }, "regjsparser": { "version": "0.1.5", - "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "requires": { "jsesc": "~0.5.0" @@ -34107,7 +34106,7 @@ "dependencies": { "underscore": { "version": "1.6.0", - "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", "dev": true } @@ -36177,7 +36176,7 @@ }, "split2": { "version": "0.2.1", - "resolved": "http://registry.npmjs.org/split2/-/split2-0.2.1.tgz", + "resolved": "https://registry.npmjs.org/split2/-/split2-0.2.1.tgz", "integrity": "sha1-At2smtwD7Au3jBKC7Aecpuha6QA=", "dev": true, "requires": { @@ -36204,7 +36203,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, @@ -36222,7 +36221,7 @@ }, "sprintf-js": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { @@ -36493,7 +36492,7 @@ }, "stream-combiner": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", "dev": true, "requires": { @@ -36618,7 +36617,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "requires": { "code-point-at": "^1.0.0", @@ -37458,7 +37457,7 @@ }, "syntax-error": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", "dev": true, "requires": { @@ -38251,7 +38250,7 @@ }, "tty-browserify": { "version": "0.0.0", - "resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=" }, "tunnel-agent": { @@ -38495,7 +38494,7 @@ "dependencies": { "underscore": { "version": "1.6.0", - "resolved": "http://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", "dev": true } @@ -38553,7 +38552,7 @@ }, "union": { "version": "0.4.6", - "resolved": "http://registry.npmjs.org/union/-/union-0.4.6.tgz", + "resolved": "https://registry.npmjs.org/union/-/union-0.4.6.tgz", "integrity": "sha1-GY+9rrolTniLDvy2MLwR8kopWeA=", "dev": true, "requires": { @@ -38562,7 +38561,7 @@ "dependencies": { "qs": { "version": "2.3.3", - "resolved": "http://registry.npmjs.org/qs/-/qs-2.3.3.tgz", + "resolved": "https://registry.npmjs.org/qs/-/qs-2.3.3.tgz", "integrity": "sha1-6eha2+ddoLvkyOBHaghikPhjtAQ=", "dev": true } @@ -39197,7 +39196,7 @@ }, "vm-browserify": { "version": "0.0.4", - "resolved": "http://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", "requires": { "indexof": "0.0.1" @@ -39216,7 +39215,7 @@ }, "walk-sync": { "version": "0.3.1", - "resolved": "http://registry.npmjs.org/walk-sync/-/walk-sync-0.3.1.tgz", + "resolved": "https://registry.npmjs.org/walk-sync/-/walk-sync-0.3.1.tgz", "integrity": "sha1-VYoWrqyMDbWcAotzxm85doTs5GU=", "dev": true, "requires": { @@ -39234,7 +39233,7 @@ }, "watchify": { "version": "3.11.0", - "resolved": "http://registry.npmjs.org/watchify/-/watchify-3.11.0.tgz", + "resolved": "https://registry.npmjs.org/watchify/-/watchify-3.11.0.tgz", "integrity": "sha512-7jWG0c3cKKm2hKScnSAMUEUjRJKXUShwMPk0ASVhICycQhwND3IMAdhJYmc1mxxKzBUJTSF5HZizfrKrS6BzkA==", "dev": true, "requires": { @@ -40352,7 +40351,7 @@ }, "winston": { "version": "2.1.1", - "resolved": "http://registry.npmjs.org/winston/-/winston-2.1.1.tgz", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz", "integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=", "dev": true, "requires": { From cf9b33356123ca7331dcc77590fab4773064bb0d Mon Sep 17 00:00:00 2001 From: dennistikhomirov Date: Thu, 27 Dec 2018 01:26:11 -0800 Subject: [PATCH 4/6] e2e: check order in executor list --- package-lock.json | 100 +++++++++++++++----------------------- test/e2e/elements.js | 1 + test/e2e/metamask.spec.js | 79 ++++++++++++++++++------------ 3 files changed, 86 insertions(+), 94 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6a608903d607..2e4d5ab31e85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10204,13 +10204,12 @@ "resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz", "integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=", "requires": { - "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "ethereumjs-util": "^5.1.1" }, "dependencies": { "ethereumjs-abi": { "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", - "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", + "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "requires": { "bn.js": "^4.10.0", "ethereumjs-util": "^5.0.0" @@ -10473,13 +10472,12 @@ "resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz", "integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=", "requires": { - "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "ethereumjs-util": "^5.1.1" }, "dependencies": { "ethereumjs-abi": { "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", - "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", + "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "requires": { "bn.js": "^4.10.0", "ethereumjs-util": "^5.0.0" @@ -11196,13 +11194,12 @@ "resolved": "https://registry.npmjs.org/eth-sig-util/-/eth-sig-util-1.4.2.tgz", "integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=", "requires": { - "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "ethereumjs-util": "^5.1.1" }, "dependencies": { "ethereumjs-abi": { "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", - "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", + "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "requires": { "bn.js": "^4.10.0", "ethereumjs-util": "^5.0.0" @@ -15014,8 +15011,7 @@ "bindings": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", - "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==", - "dev": true + "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" }, "bip39": { "version": "2.5.0", @@ -15034,7 +15030,6 @@ "version": "1.1.5", "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", - "dev": true, "requires": { "safe-buffer": "^5.0.1" } @@ -15069,8 +15064,7 @@ "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "dev": true + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, "body-parser": { "version": "1.18.3", @@ -15113,14 +15107,12 @@ "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, "browserify-aes": { "version": "1.2.0", "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, "requires": { "buffer-xor": "^1.0.3", "cipher-base": "^1.0.0", @@ -15277,8 +15269,7 @@ "buffer-xor": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, "builtin-modules": { "version": "1.1.1", @@ -15376,7 +15367,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dev": true, "requires": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -15536,7 +15526,6 @@ "version": "1.2.0", "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dev": true, "requires": { "cipher-base": "^1.0.1", "inherits": "^2.0.1", @@ -15549,7 +15538,6 @@ "version": "1.1.7", "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dev": true, "requires": { "cipher-base": "^1.0.3", "create-hash": "^1.1.0", @@ -15849,7 +15837,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", - "dev": true, "requires": { "browserify-aes": "^1.0.6", "create-hash": "^1.1.2", @@ -15888,7 +15875,6 @@ "version": "6.4.1", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", - "dev": true, "requires": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -16179,8 +16165,17 @@ "integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=", "dev": true, "requires": { - "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "ethereumjs-util": "^5.1.1" + }, + "dependencies": { + "ethereumjs-abi": { + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", + "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", + "requires": { + "bn.js": "^4.10.0", + "ethereumjs-util": "^5.0.0" + } + } } }, "ethereum-common": { @@ -16192,7 +16187,6 @@ "ethereumjs-abi": { "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", - "dev": true, "requires": { "bn.js": "^4.10.0", "ethereumjs-util": "^5.0.0" @@ -16387,7 +16381,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", - "dev": true, "requires": { "bn.js": "^4.11.0", "create-hash": "^1.1.2", @@ -16477,7 +16470,6 @@ "version": "0.1.6", "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", - "dev": true, "requires": { "is-hex-prefixed": "1.0.0", "strip-hex-prefix": "1.0.0" @@ -16499,7 +16491,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, "requires": { "md5.js": "^1.3.4", "safe-buffer": "^5.1.1" @@ -16910,7 +16901,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", - "dev": true, "requires": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -16920,7 +16910,6 @@ "version": "1.1.5", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", - "dev": true, "requires": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" @@ -16948,7 +16937,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, "requires": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", @@ -17116,8 +17104,7 @@ "is-hex-prefixed": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", - "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", - "dev": true + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" }, "is-natural-number": { "version": "4.0.1", @@ -17171,8 +17158,7 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "is-utf8": { "version": "0.2.1", @@ -17318,7 +17304,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", - "dev": true, "requires": { "bindings": "^1.2.1", "inherits": "^2.0.3", @@ -17618,7 +17603,6 @@ "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dev": true, "requires": { "hash-base": "^3.0.0", "inherits": "^2.0.1", @@ -17778,14 +17762,12 @@ "minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" }, "minimalistic-crypto-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, "minimatch": { "version": "3.0.4", @@ -17837,8 +17819,7 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "mz": { "version": "2.7.0", @@ -17855,8 +17836,7 @@ "nan": { "version": "2.10.0", "resolved": "http://registry.npmjs.org/nan/-/nan-2.10.0.tgz", - "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", - "dev": true + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" }, "nano-json-stream-parser": { "version": "0.1.2", @@ -18523,7 +18503,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, "requires": { "hash-base": "^3.0.0", "inherits": "^2.0.1" @@ -18533,7 +18512,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.1.0.tgz", "integrity": "sha512-93U7IKH5j7nmXFVg19MeNBGzQW5uXW1pmCuKY8veeKIhYTE32C2d0mOegfiIAfXcHOKJjjPlJisn8iHDF5AezA==", - "dev": true, "requires": { "safe-buffer": "^5.1.1" } @@ -18547,8 +18525,7 @@ "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "safe-event-emitter": { "version": "1.0.1", @@ -18600,7 +18577,6 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.5.2.tgz", "integrity": "sha512-iin3kojdybY6NArd+UFsoTuapOF7bnJNf2UbcWXaY3z+E1sJDipl60vtzB5hbO/uquBu7z0fd4VC4Irp+xoFVQ==", - "dev": true, "requires": { "bindings": "^1.2.1", "bip66": "^1.1.3", @@ -18732,7 +18708,6 @@ "version": "2.4.11", "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, "requires": { "inherits": "^2.0.1", "safe-buffer": "^5.0.1" @@ -18943,7 +18918,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", - "dev": true, "requires": { "is-hex-prefixed": "1.0.0" } @@ -19187,7 +19161,6 @@ "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, "requires": { "is-typedarray": "^1.0.0" } @@ -19630,14 +19603,22 @@ "integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=", "dev": true, "requires": { - "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "ethereumjs-util": "^5.1.1" + }, + "dependencies": { + "ethereumjs-abi": { + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", + "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", + "requires": { + "bn.js": "^4.10.0", + "ethereumjs-util": "^5.0.0" + } + } } }, "ethereumjs-abi": { "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#2863c40e0982acfc0b7163f0285d4c56427c7799", "from": "git+https://github.com/ethereumjs/ethereumjs-abi.git", - "dev": true, "requires": { "bn.js": "^4.10.0", "ethereumjs-util": "^5.0.0" @@ -19682,23 +19663,20 @@ "dev": true, "requires": { "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + "web3-core-helpers": "1.0.0-beta.35" }, "dependencies": { "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, "requires": { "ms": "2.0.0" } }, "websocket": { "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", - "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", - "dev": true, + "from": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", "requires": { "debug": "^2.2.0", "nan": "^2.3.3", @@ -19877,8 +19855,7 @@ "yaeti": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", - "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=", - "dev": true + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" }, "yargs": { "version": "4.8.1", @@ -39274,7 +39251,6 @@ "resolved": "https://registry.npmjs.org/web3/-/web3-0.20.3.tgz", "integrity": "sha1-yqRDc9yIFayHZ73ba6cwc5ZMqos=", "requires": { - "bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", "crypto-js": "^3.1.4", "utf8": "^2.1.1", "xhr2": "*", @@ -39283,7 +39259,7 @@ "dependencies": { "bignumber.js": { "version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934", - "from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git" + "from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934" } } }, diff --git a/test/e2e/elements.js b/test/e2e/elements.js index 43d122238bce..d2823988295b 100644 --- a/test/e2e/elements.js +++ b/test/e2e/elements.js @@ -59,6 +59,7 @@ module.exports = { titleText: 'Choose contract executor', buttonNext: By.css('.choose-contract-next-button'), account: By.className('account-data-subsection flex-row flex-grow'), + addressExecutor: By.className('flex-row flex-center'), selectedAccount: By.className('executor-cell-container-selected'), buttonArrow: By.className('fa fa-arrow-left fa-lg cursor-pointer'), diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index 57c7051de38a..16386eca7544 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -12,7 +12,7 @@ const { menus, screens, elements, NETWORKS } = require('./elements') const testSeedPhrase = 'horn among position unable audit puzzle cannon apology gun autumn plug parrot' const account1 = '0x2E428ABd9313D256d64D1f69fe3929C3BE18fD1f' const account2 = '0xd7b7AFeCa35e32594e29504771aC847E2a803742' -const createdAccounts = [] +const accountsWallet = [] const eventsEmitter = 'https://vbaranov.github.io/event-listener-dapp/' describe('Metamask popup page', async function () { @@ -147,9 +147,9 @@ describe('Metamask popup page', async function () { it("Account's address is displayed and has length 20 symbols", async () => { const field = await waitUntilShowUp(screens.main.address) - createdAccounts.push((await field.getText()).toUpperCase()) - console.log(createdAccounts[0]) - assert.notEqual(createdAccounts[0].length, 20, "address isn't displayed") + accountsWallet.push((await field.getText()).toUpperCase()) + console.log(accountsWallet[0]) + assert.notEqual(accountsWallet[0].length, 20, "address isn't displayed") }) it('Check clipboard buffer', async function () { const text = clipboardy.readSync() @@ -198,9 +198,9 @@ describe('Metamask popup page', async function () { it("Account's address is displayed and has length 20 symbols", async () => { const field = await waitUntilShowUp(screens.main.address) - createdAccounts.push((await field.getText()).toUpperCase()) - console.log(createdAccounts[1]) - assert.notEqual(createdAccounts[1].length, 20, "address isn't displayed") + accountsWallet.push((await field.getText()).toUpperCase()) + console.log(accountsWallet[1]) + assert.notEqual(accountsWallet[1].length, 20, "address isn't displayed") }) it('logs out of the vault', async () => { @@ -230,7 +230,7 @@ describe('Metamask popup page', async function () { it('checks QR code address is the same as account details address', async () => { const field = await waitUntilShowUp(screens.QRcode.address) const text = await field.getText() - assert.equal(text.toUpperCase(), createdAccounts[1], 'QR address doesn\'t match') + assert.equal(text.toUpperCase(), accountsWallet[1], 'QR address doesn\'t match') }) it('copy icon is displayed and clickable', async () => { @@ -281,6 +281,7 @@ describe('Metamask popup page', async function () { it('Imports account', async function () { const privateKeyBox = await waitUntilShowUp(screens.importAccounts.fieldPrivateKey) await privateKeyBox.sendKeys('76bd0ced0a47055bb5d060e1ae4a8cb3ece658d668823e250dae6e79d3ab4435')// 0xf4702CbA917260b2D6731Aea6385215073e8551b + accountsWallet.push('0xf4702CbA917260b2D6731Aea6385215073e8551b'.toUpperCase()) const button = await waitUntilShowUp(screens.importAccounts.buttonImport) await click(button) assert.equal(await button.getText(), 'Import', 'button has incorrect name') @@ -322,7 +323,7 @@ describe('Metamask popup page', async function () { }) describe('Import Contract account', async () => { - const contractSokol = '0x215b2ab35749e5a9f3efe890de602fb9844e842f' + const contractSokol = '0x61449bb37db034b2394cd62da545611f71cf54d5' console.log('Contract ' + contractSokol + ' , Sokol') const wrongAddress = '0xB87b6077D59B01Ab9fa8cd5A1A21D02a4d60D35' const notContractAddress = '0x56B2e3C3cFf7f3921Dc2e0F8B8e20d1eEc29216b' @@ -404,7 +405,7 @@ describe('Metamask popup page', async function () { it('ABI is fetched ', async function () { const field = await waitUntilShowUp(screens.importAccounts.contractABI) abiClipboard = await field.getText() - assert.equal(abiClipboard.length, 4457, "ABI isn't fetched") + assert.equal(abiClipboard.length, 4927, "ABI isn't fetched") }) it('icon copy is displayed for ABI ', async function () { @@ -455,6 +456,7 @@ describe('Metamask popup page', async function () { }) describe('Execute Method screen', () => { + const amountMethods = 25 const notContractAddress = '0x56B2e3C3cFf7f3921Dc2e0F8B8e20d1eEc29216b' describe("Check UI and button's functionality", () => { @@ -497,8 +499,8 @@ describe('Metamask popup page', async function () { await field.click() await waitUntilShowUp(screens.executeMethod.items) const list = await driver.findElements(screens.executeMethod.items) - await list[3].click() - assert.equal(list.length, 22, "drop down menu isn't displayed") + await list[6].click() + assert.equal(list.length, amountMethods, "drop down menu isn't displayed") }) it("Button 'Call data' is displayed and disabled", async function () { @@ -560,8 +562,8 @@ describe('Metamask popup page', async function () { await field.click() await waitUntilShowUp(screens.executeMethod.items) const list = await driver.findElements(screens.executeMethod.items) - await list[14].click() - assert.equal(list.length, 22, "drop down menu isn't displayed") + await list[17].click() + assert.equal(list.length, amountMethods, "drop down menu isn't displayed") }) it('Fill out input parameter field ', async function () { @@ -602,8 +604,8 @@ describe('Metamask popup page', async function () { await field.click() await waitUntilShowUp(screens.executeMethod.items) const list = await driver.findElements(screens.executeMethod.items) - await list[5].click() - assert.equal(list.length, 22, "drop down menu isn't displayed") + await list[8].click() + assert.equal(list.length, amountMethods, "drop down menu isn't displayed") }) it('Select value TRUE from dropdown menu', async function () { @@ -677,8 +679,8 @@ describe('Metamask popup page', async function () { await field.click() await waitUntilShowUp(screens.executeMethod.items) const list = await driver.findElements(screens.executeMethod.items) - await list[7].click() - assert.equal(list.length, 22, "drop down menu isn't displayed") + await list[10].click() + assert.equal(list.length, amountMethods, "drop down menu isn't displayed") }) it('Fill out input parameter field ', async function () { @@ -723,8 +725,8 @@ describe('Metamask popup page', async function () { await field.click() await waitUntilShowUp(screens.executeMethod.items) const list = await driver.findElements(screens.executeMethod.items) - await list[17].click() - assert.equal(list.length, 22, "drop down menu isn't displayed") + await list[20].click() + assert.equal(list.length, amountMethods, "drop down menu isn't displayed") }) it('Fill out input parameter field ', async function () { @@ -770,8 +772,8 @@ describe('Metamask popup page', async function () { await field.click() await waitUntilShowUp(screens.executeMethod.items) const list = await driver.findElements(screens.executeMethod.items) - await list[10].click() - assert.equal(list.length, 22, "drop down menu isn't displayed") + await list[13].click() + assert.equal(list.length, amountMethods, "drop down menu isn't displayed") }) it('Fill out input parameter field ', async function () { @@ -814,8 +816,8 @@ describe('Metamask popup page', async function () { await field.click() await waitUntilShowUp(screens.executeMethod.items) const list = await driver.findElements(screens.executeMethod.items) - await list[21].click() - assert.equal(list.length, 22, "drop down menu isn't displayed") + await list[24].click() + assert.equal(list.length, amountMethods, "drop down menu isn't displayed") }) it("Button 'Copy ABI encoded' is displayed", async function () { @@ -919,11 +921,20 @@ describe('Metamask popup page', async function () { assert.equal(await title.getText(), screens.chooseContractExecutor.titleText, 'incorrect text') }) - it('Two accounts displayed', async function () { + it('Three accounts are displayed', async function () { const accs = await waitUntilShowUp(screens.chooseContractExecutor.account) - assert.notEqual(accs, false, 'accounts aren\'t displayed') + assert.notEqual(accs, false, "accounts aren't displayed") const accounts = await driver.findElements(screens.chooseContractExecutor.account) - assert.equal(accounts.length, 4, "number of accounts isn't 2") + assert.equal(accounts.length, 4, "number of accounts isn't 3") + }) + + it("Owner's account first in the list of executors", async function () { + const accs = await waitUntilShowUp(screens.chooseContractExecutor.addressExecutor) + assert.notEqual(accs, false, "addresses aren't displayed") + const addresses = await driver.findElements(screens.chooseContractExecutor.addressExecutor) + const address = await addresses[2].getText() + const souldBe = accountsWallet[2].slice(0, 10) + '...' + accountsWallet[2].slice(accountsWallet[2].length - 4, accountsWallet[2].length) + assert.equal(address.toUpperCase(), souldBe, "owner isn't first in the list") }) it("Click arrow button leads to 'Execute Method' screen ", async function () { @@ -950,8 +961,10 @@ describe('Metamask popup page', async function () { }) it('User is able to select account', async function () { + await delay(2000) await waitUntilShowUp(screens.chooseContractExecutor.account) const accounts = await driver.findElements(screens.chooseContractExecutor.account) + console.log(accounts.length) const account = accounts[1] await account.click() const selected = await driver.findElements(screens.chooseContractExecutor.selectedAccount) @@ -961,6 +974,7 @@ describe('Metamask popup page', async function () { it('User is able to select only one account', async function () { const account = (await driver.findElements(screens.chooseContractExecutor.account))[2] await account.click() + await delay(20000) const selected = await driver.findElements(screens.chooseContractExecutor.selectedAccount) assert.equal(selected.length, 1, 'more than one accounts are selected') }) @@ -998,13 +1012,13 @@ describe('Metamask popup page', async function () { }) it("Button arrow leads to executor's account screen", async function () { - assert.equal(await executeTransferMethod(0), true, "can't execute the method 'transfer'") + assert.equal(await executeTransferMethod(1), true, "can't execute the method 'transfer'") await delay(2000) const arrow = await waitUntilShowUp(elements.buttonArrow) await arrow.click() await delay(2000) const address = await waitUntilShowUp(screens.main.address) - assert.equal((await address.getText()).toUpperCase(), createdAccounts[0], "executors account isn't opened") + assert.equal((await address.getText()).toUpperCase(), accountsWallet[0], "executors account isn't opened") }) it('Switch to contract account ', async function () { @@ -1018,7 +1032,7 @@ describe('Metamask popup page', async function () { }) it("Confirm transaction: button 'Reject All' leads to contract's account screen", async function () { - assert.equal(await executeTransferMethod(0), true, "can't execute the method 'transfer'") + assert.equal(await executeTransferMethod(1), true, "can't execute the method 'transfer'") const rejectAll = await waitUntilShowUp(screens.confirmTransaction.button.rejectAll) assert.equal(await rejectAll.getText(), 'Reject All', 'button has incorrect name') await rejectAll.click() @@ -1028,7 +1042,7 @@ describe('Metamask popup page', async function () { }) it("Confirm transaction: button 'Submit' leads to contract's account screen", async function () { - assert.equal(await executeTransferMethod(2), true, "can't execute the method 'transfer'") + assert.equal(await executeTransferMethod(0), true, "can't execute the method 'transfer'") await delay(2000) const button = await waitUntilShowUp(screens.confirmTransaction.button.submit) // assert.equal(await button.getText(), 'Submit', "button has incorrect name") @@ -3038,7 +3052,7 @@ describe('Metamask popup page', async function () { await menu.click() await waitUntilShowUp(screens.executeMethod.items) const list = await driver.findElements(screens.executeMethod.items) - await list[21].click() + await list[24].click() // Fill out value await waitUntilShowUp(screens.executeMethod.fieldParameter) const fields = await driver.findElements(screens.executeMethod.fieldParameter) @@ -3053,6 +3067,7 @@ describe('Metamask popup page', async function () { assert.notEqual(buttonNext, false, "button 'Next' isn't displayed") await buttonNext.click() // Select executor + await delay(2000) await waitUntilShowUp(screens.chooseContractExecutor.account) const accounts = await driver.findElements(screens.chooseContractExecutor.account) const account = accounts[executor + 1] From c17261c79e051e8d2d1243c6de6473f5a03dfeca Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 28 Dec 2018 16:42:25 +0300 Subject: [PATCH 5/6] Updated e2e from Dennis --- test/e2e/metamask.spec.js | 836 +++++++++++++++++++------------------- 1 file changed, 420 insertions(+), 416 deletions(-) diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js index 16386eca7544..51133f115129 100644 --- a/test/e2e/metamask.spec.js +++ b/test/e2e/metamask.spec.js @@ -150,6 +150,7 @@ describe('Metamask popup page', async function () { accountsWallet.push((await field.getText()).toUpperCase()) console.log(accountsWallet[0]) assert.notEqual(accountsWallet[0].length, 20, "address isn't displayed") + }) it('Check clipboard buffer', async function () { const text = clipboardy.readSync() @@ -201,6 +202,7 @@ describe('Metamask popup page', async function () { accountsWallet.push((await field.getText()).toUpperCase()) console.log(accountsWallet[1]) assert.notEqual(accountsWallet[1].length, 20, "address isn't displayed") + }) it('logs out of the vault', async () => { @@ -320,7 +322,6 @@ describe('Metamask popup page', async function () { console.log('Balance = ' + balance) assert.equal(parseFloat(balance) > 0.001, true, 'Balance of account 0xf4702CbA917260b2D6731Aea6385215073e8551b TOO LOW !!! Please refill with Sokol eth!!!!') }) - }) describe('Import Contract account', async () => { const contractSokol = '0x61449bb37db034b2394cd62da545611f71cf54d5' @@ -767,7 +768,7 @@ describe('Metamask popup page', async function () { const int256Value = '-1122334455667788991122334455667788' - it("Select method 'returnInt256'", async function () { + it("Select method 'returnInt256'", async function () { const field = await waitUntilShowUp(screens.executeMethod.selectArrow) await field.click() await waitUntilShowUp(screens.executeMethod.items) @@ -921,6 +922,7 @@ describe('Metamask popup page', async function () { assert.equal(await title.getText(), screens.chooseContractExecutor.titleText, 'incorrect text') }) + it('Three accounts are displayed', async function () { const accs = await waitUntilShowUp(screens.chooseContractExecutor.account) assert.notEqual(accs, false, "accounts aren't displayed") @@ -934,7 +936,7 @@ describe('Metamask popup page', async function () { const addresses = await driver.findElements(screens.chooseContractExecutor.addressExecutor) const address = await addresses[2].getText() const souldBe = accountsWallet[2].slice(0, 10) + '...' + accountsWallet[2].slice(accountsWallet[2].length - 4, accountsWallet[2].length) - assert.equal(address.toUpperCase(), souldBe, "owner isn't first in the list") + assert.equal(address.toUpperCase(), souldBe, "owner isn't first in the list") }) it("Click arrow button leads to 'Execute Method' screen ", async function () { @@ -1012,6 +1014,7 @@ describe('Metamask popup page', async function () { }) it("Button arrow leads to executor's account screen", async function () { + assert.equal(await executeTransferMethod(1), true, "can't execute the method 'transfer'") await delay(2000) const arrow = await waitUntilShowUp(elements.buttonArrow) @@ -1019,6 +1022,7 @@ describe('Metamask popup page', async function () { await delay(2000) const address = await waitUntilShowUp(screens.main.address) assert.equal((await address.getText()).toUpperCase(), accountsWallet[0], "executors account isn't opened") + }) it('Switch to contract account ', async function () { @@ -1042,6 +1046,7 @@ describe('Metamask popup page', async function () { }) it("Confirm transaction: button 'Submit' leads to contract's account screen", async function () { + assert.equal(await executeTransferMethod(0), true, "can't execute the method 'transfer'") await delay(2000) const button = await waitUntilShowUp(screens.confirmTransaction.button.submit) @@ -1128,7 +1133,7 @@ describe('Metamask popup page', async function () { it('Simulate sign request ', async function () { await setProvider(NETWORKS.LOCALHOST) await driver.get('https://danfinlay.github.io/js-eth-personal-sign-examples/') - const button = await waitUntilShowUp(By.id('ethSignButton')) + const button = await waitUntilShowUp(By.id('ethSignButton')) await button.click() }) @@ -1308,8 +1313,8 @@ describe('Metamask popup page', async function () { const inputAmmount = await waitUntilShowUp(screens.sendTransaction.field.amount) await inputAddress.sendKeys(account2) await inputAmmount.sendKeys('10') - const button = await waitUntilShowUp(screens.sendTransaction.buttonNext) - assert.equal(await button.getText(), 'Next', 'button has incorrect name') + const button = await waitUntilShowUp(screens.sendTransaction.buttonNext) + assert.equal(await button.getText(), 'Next', 'button has incorrect name') await click(button) }) @@ -1323,9 +1328,9 @@ describe('Metamask popup page', async function () { const transactionAmount = await waitUntilShowUp(screens.main.transactionList) assert.equal(await transactionAmount.getText(), '10.0') }) - }) + }) - describe(' Check the filter of emitted events', function () { + describe(' Check the filter of emitted events', function () { it('emit event', async function () { await setProvider(NETWORKS.SOKOL) @@ -1346,10 +1351,10 @@ describe('Metamask popup page', async function () { console.log('Account = ' + account) console.log('Balance = ' + balance) assert.equal(parseFloat(balance) > 0.001, true, 'Balance of account ' + account + ' TOO LOW !!! Please refill with Sokol eth!!!!') - await driver.get(eventsEmitter) - const button = await waitUntilShowUp(screens.eventsEmitter.button) - await button.click() - await delay(1000) + await driver.get(eventsEmitter) + const button = await waitUntilShowUp(screens.eventsEmitter.button) + await button.click() + await delay(1000) }) it('confirms transaction in MetaMask popup', async function () { @@ -1358,8 +1363,8 @@ describe('Metamask popup page', async function () { await delay(5000) const gasPrice = await waitUntilShowUp(screens.confirmTransaction.fields.gasPrice) await gasPrice.sendKeys('10') - const button = await waitUntilShowUp(screens.confirmTransaction.button.submit) - await click(button) + const button = await waitUntilShowUp(screens.confirmTransaction.button.submit) + await click(button) }) it('check number of events', async function () { @@ -2517,74 +2522,74 @@ describe('Metamask popup page', async function () { counter = 7 } await driver.executeScript("document.getElementsByClassName('dropdown-menu-item')[" + counter + '].click();') - } + } - async function scrollTo (element) { - try { + async function scrollTo (element) { + try { await driver.executeScript('arguments[0].scrollIntoView();', element) return true } catch (err) { return false } - } + } - async function click (element) { - try { + async function click (element) { + try { await element.sendKeys(Key.RETURN) return true } catch (err) { return false } - } + } - async function clearField (field, number) { - await click(field) - if (number === undefined) number = 40 - for (let i = 0; i < number; i++) { + async function clearField (field, number) { + await click(field) + if (number === undefined) number = 40 + for (let i = 0; i < number; i++) { await field.sendKeys(Key.BACK_SPACE) } - } + } - async function waitUntilDisappear (by, Twait) { - if (Twait === undefined) Twait = 10 - do { + async function waitUntilDisappear (by, Twait) { + if (Twait === undefined) Twait = 10 + do { if (!await isElementDisplayed(by)) return true } while (Twait-- > 0) - return false - } + return false + } - async function waitUntilShowUp (by, Twait) { - if (Twait === undefined) Twait = 200 - do { + async function waitUntilShowUp (by, Twait) { + if (Twait === undefined) Twait = 200 + do { await delay(100) if (await isElementDisplayed(by)) return await driver.findElement(by) } while (Twait-- > 0) - return false - } + return false + } - async function waitUntilHasValue (element, Twait) { - if (Twait === undefined) Twait = 200 - let text - do { + async function waitUntilHasValue (element, Twait) { + if (Twait === undefined) Twait = 200 + let text + do { await delay(100) text = await element.getAttribute('value') if (text !== '') return text } while (Twait-- > 0) - return false - } + return false + } - async function isElementDisplayed (by) { - try { + async function isElementDisplayed (by) { + try { return await driver.findElement(by).isDisplayed() } catch (err) { return false } - } + } - async function assertTokensNotDisplayed () { - try { + async function assertTokensNotDisplayed () { + try { await delay(800) await waitUntilDisappear(elements.loader) assert.notEqual(await waitUntilShowUp(screens.main.tokens.amount), false, 'App is frozen') @@ -2602,64 +2607,64 @@ describe('Metamask popup page', async function () { console.log(err) return false } - } + } - async function isDisabledAddInexistentToken (tokenAddress) { - await delay(500) - try { + async function isDisabledAddInexistentToken (tokenAddress) { + await delay(500) + try { const tab = await waitUntilShowUp(screens.main.tokens.menu) await click(tab) const button = await waitUntilShowUp(screens.main.tokens.buttonAdd, 300) await click(button) let count = 20 do { - await delay(500) - const tab = await waitUntilShowUp(screens.addToken.tab.custom, 10) - try { - await tab.click() - } catch (err) { - } - } + await delay(500) + const tab = await waitUntilShowUp(screens.addToken.tab.custom, 10) + try { + await tab.click() + } catch (err) { + } + } while ((await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) === false) && (count-- > 0)) } catch (err) { } - const fieldAddress = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) - await clearField(fieldAddress) - await fieldAddress.sendKeys(tokenAddress) + const fieldAddress = await waitUntilShowUp(screens.addToken.custom.fields.contractAddress) + await clearField(fieldAddress) + await fieldAddress.sendKeys(tokenAddress) - const fieldSymbols = await waitUntilShowUp(screens.addToken.custom.fields.tokenSymbol) - if (await fieldSymbols.isEnabled()) { + const fieldSymbols = await waitUntilShowUp(screens.addToken.custom.fields.tokenSymbol) + if (await fieldSymbols.isEnabled()) { console.log('field symbols enabled') return false } - const fieldDecimals = await waitUntilShowUp(screens.addToken.custom.fields.tokenSymbol) - if (await fieldDecimals.isEnabled()) { + const fieldDecimals = await waitUntilShowUp(screens.addToken.custom.fields.tokenSymbol) + if (await fieldDecimals.isEnabled()) { console.log('field decimals enabled') return false } - const buttonAdd = await waitUntilShowUp(screens.addToken.custom.buttons.add) - if (await buttonAdd.isEnabled()) { + const buttonAdd = await waitUntilShowUp(screens.addToken.custom.buttons.add) + if (await buttonAdd.isEnabled()) { console.log('button add enabled') return false } - const buttonCancel = await waitUntilShowUp(screens.addToken.custom.buttons.cancel) - let counter = 20 - do { + const buttonCancel = await waitUntilShowUp(screens.addToken.custom.buttons.cancel) + let counter = 20 + do { await delay(500) await click(buttonCancel) } - while (((await waitUntilShowUp(screens.main.identicon)) === false) && (counter-- > 0)) - if (counter < 1) { + while (((await waitUntilShowUp(screens.main.identicon)) === false) && (counter-- > 0)) + if (counter < 1) { console.log('button cancel doesn\'t work') return false } - return true - } + return true + } - async function checkBrowserForConsoleErrors () { - const ignoredLogTypes = ['WARNING'] - const ignoredErrorMessages = [ + async function checkBrowserForConsoleErrors () { + const ignoredLogTypes = ['WARNING'] + const ignoredErrorMessages = [ // React throws error warnings on "dataset", but still sets the data-* properties correctly 'Warning: Unknown prop `dataset` on ', // Third-party Favicon 404s show up as errors @@ -2668,382 +2673,382 @@ describe('Metamask popup page', async function () { 'Warning: It looks like you\'re using a minified copy of the development build of React.', // Redux Development build - known issue blocked by test build sys 'This means that you are running a slower development build of Redux.', - ] - const browserLogs = await driver.manage().logs().get('browser') - const errorEntries = browserLogs.filter(entry => !ignoredLogTypes.includes(entry.level.toString())) - const errorObjects = errorEntries.map(entry => entry.toJSON()) - // ignore all errors that contain a message in `ignoredErrorMessages` - const matchedErrorObjects = errorObjects.filter(entry => !ignoredErrorMessages.some(message => entry.message.includes(message))) - return matchedErrorObjects - } + ] + const browserLogs = await driver.manage().logs().get('browser') + const errorEntries = browserLogs.filter(entry => !ignoredLogTypes.includes(entry.level.toString())) + const errorObjects = errorEntries.map(entry => entry.toJSON()) + // ignore all errors that contain a message in `ignoredErrorMessages` + const matchedErrorObjects = errorObjects.filter(entry => !ignoredErrorMessages.some(message => entry.message.includes(message))) + return matchedErrorObjects + } - async function verboseReportOnFailure (test) { - let artifactDir - if (process.env.SELENIUM_BROWSER === 'chrome') { + async function verboseReportOnFailure (test) { + let artifactDir + if (process.env.SELENIUM_BROWSER === 'chrome') { artifactDir = `./test-artifacts/chrome/${test.title}` } else if (process.env.SELENIUM_BROWSER === 'firefox') { artifactDir = `./test-artifacts/firefox/${test.title}` } - const filepathBase = `${artifactDir}/test-failure` - await pify(mkdirp)(artifactDir) - // capture screenshot - const screenshot = await driver.takeScreenshot() - await pify(fs.writeFile)(`${filepathBase}-screenshot.png`, screenshot, { encoding: 'base64' }) - // capture dom source - const htmlSource = await driver.getPageSource() - await pify(fs.writeFile)(`${filepathBase}-dom.html`, htmlSource) - } + const filepathBase = `${artifactDir}/test-failure` + await pify(mkdirp)(artifactDir) + // capture screenshot + const screenshot = await driver.takeScreenshot() + await pify(fs.writeFile)(`${filepathBase}-screenshot.png`, screenshot, { encoding: 'base64' }) + // capture dom source + const htmlSource = await driver.getPageSource() + await pify(fs.writeFile)(`${filepathBase}-dom.html`, htmlSource) + } - async function switchToLastPage () { - try { + async function switchToLastPage () { + try { const allHandles = await driver.getAllWindowHandles() await driver.switchTo().window(allHandles[allHandles.length - 1]) let counter = 100 do { - await delay(500) - if (await driver.getCurrentUrl() !== '') return true - } + await delay(500) + if (await driver.getCurrentUrl() !== '') return true + } while (counter-- > 0) return true } catch (err) { return false } - } + } - async function switchToFirstPage () { - try { + async function switchToFirstPage () { + try { const allHandles = await driver.getAllWindowHandles() console.log('allHandles.length ' + allHandles.length) await driver.switchTo().window(allHandles[0]) let counter = 100 do { - await delay(500) - if (await driver.getCurrentUrl() !== '') return true - } + await delay(500) + if (await driver.getCurrentUrl() !== '') return true + } while (counter-- > 0) return true } catch (err) { return false } - } + } - async function waitUntilCurrentUrl () { - try { + async function waitUntilCurrentUrl () { + try { let title let counter = 20 do { - await delay(500) - title = await driver.getCurrentUrl() - } while ((title === '') && (counter-- > 0)) + await delay(500) + title = await driver.getCurrentUrl() + } while ((title === '') && (counter-- > 0)) if (counter < 1) return false return title } catch (err) { console.log(err) return false } - } + } - async function createToken (owner, { supply, name, decimals, ticker }, isDelayed) { - - const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545/')) - const abi = [ - { - 'constant': true, - 'inputs': [], - 'name': 'name', - 'outputs': [ - { - 'name': '', - 'type': 'string', - }, - ], - 'payable': false, - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'constant': false, - 'inputs': [ - { - 'name': '_spender', - 'type': 'address', - }, - { - 'name': '_value', - 'type': 'uint256', - }, - ], - 'name': 'approve', - 'outputs': [ - { - 'name': 'success', - 'type': 'bool', - }, - ], - 'payable': false, - 'stateMutability': 'nonpayable', - 'type': 'function', - }, - { - 'constant': true, - 'inputs': [], - 'name': 'totalSupply', - 'outputs': [ - { - 'name': '', - 'type': 'uint256', - }, - ], - 'payable': false, - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'constant': false, - 'inputs': [ - { - 'name': '_from', - 'type': 'address', - }, - { - 'name': '_to', - 'type': 'address', - }, - { - 'name': '_value', - 'type': 'uint256', - }, - ], - 'name': 'transferFrom', - 'outputs': [ - { - 'name': 'success', - 'type': 'bool', - }, - ], - 'payable': false, - 'stateMutability': 'nonpayable', - 'type': 'function', - }, - { - 'constant': true, - 'inputs': [ - { - 'name': '', - 'type': 'address', - }, - ], - 'name': 'balances', - 'outputs': [ - { - 'name': '', - 'type': 'uint256', - }, - ], - 'payable': false, - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'constant': true, - 'inputs': [], - 'name': 'decimals', - 'outputs': [ - { - 'name': '', - 'type': 'uint8', - }, - ], - 'payable': false, - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'constant': true, - 'inputs': [ - { - 'name': '', - 'type': 'address', - }, - { - 'name': '', - 'type': 'address', - }, - ], - 'name': 'allowed', - 'outputs': [ - { - 'name': '', - 'type': 'uint256', - }, - ], - 'payable': false, - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'constant': true, - 'inputs': [ - { - 'name': '_owner', - 'type': 'address', - }, - ], - 'name': 'balanceOf', - 'outputs': [ - { - 'name': 'balance', - 'type': 'uint256', - }, - ], - 'payable': false, - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'constant': true, - 'inputs': [], - 'name': 'symbol', - 'outputs': [ - { - 'name': '', - 'type': 'string', - }, - ], - 'payable': false, - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'constant': false, - 'inputs': [ - { - 'name': '_to', - 'type': 'address', - }, - { - 'name': '_value', - 'type': 'uint256', - }, - ], - 'name': 'transfer', - 'outputs': [ - { - 'name': 'success', - 'type': 'bool', - }, - ], - 'payable': false, - 'stateMutability': 'nonpayable', - 'type': 'function', - }, - { - 'constant': true, - 'inputs': [ - { - 'name': '_owner', - 'type': 'address', - }, - { - 'name': '_spender', - 'type': 'address', - }, - ], - 'name': 'allowance', - 'outputs': [ - { - 'name': 'remaining', - 'type': 'uint256', - }, - ], - 'payable': false, - 'stateMutability': 'view', - 'type': 'function', - }, - { - 'inputs': [ - { - 'name': '_initialAmount', - 'type': 'uint256', - }, - { - 'name': '_tokenName', - 'type': 'string', - }, - { - 'name': '_decimalUnits', - 'type': 'uint8', - }, - { - 'name': '_tokenSymbol', - 'type': 'string', - }, - ], - 'payable': false, - 'stateMutability': 'nonpayable', - 'type': 'constructor', - }, - { - 'anonymous': false, - 'inputs': [ - { - 'indexed': true, - 'name': '_from', - 'type': 'address', - }, - { - 'indexed': true, - 'name': '_to', - 'type': 'address', - }, - { - 'indexed': false, - 'name': '_value', - 'type': 'uint256', - }, - ], - 'name': 'Transfer', - 'type': 'event', - }, - { - 'anonymous': false, - 'inputs': [ - { - 'indexed': true, - 'name': '_owner', - 'type': 'address', - }, - { - 'indexed': true, - 'name': '_spender', - 'type': 'address', - }, - { - 'indexed': false, - 'name': '_value', - 'type': 'uint256', - }, - ], - 'name': 'Approval', - 'type': 'event', - }, - ] - const bin = '608060405234801561001057600080fd5b50604051610e30380380610e308339810180604052810190808051906020019092919080518201929190602001805190602001909291908051820192919050505083600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008190555082600390805190602001906100b29291906100ee565b5081600460006101000a81548160ff021916908360ff16021790555080600590805190602001906100e49291906100ee565b5050505050610193565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061012f57805160ff191683800117855561015d565b8280016001018555821561015d579182015b8281111561015c578251825591602001919060010190610141565b5b50905061016a919061016e565b5090565b61019091905b8082111561018c576000816000905550600101610174565b5090565b90565b610c8e806101a26000396000f3006080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d457806327e235e314610259578063313ce567146102b05780635c658165146102e157806370a082311461035857806395d89b41146103af578063a9059cbb1461043f578063dd62ed3e146104a4575b600080fd5b3480156100c057600080fd5b506100c961051b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b9565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106ab565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061029a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061094b565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c5610963565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102ed57600080fd5b50610342600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610976565b6040518082815260200191505060405180910390f35b34801561036457600080fd5b50610399600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061099b565b6040518082815260200191505060405180910390f35b3480156103bb57600080fd5b506103c46109e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104045780820151818401526020810190506103e9565b50505050905090810190601f1680156104315780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561044b57600080fd5b5061048a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a82565b604051808215151515815260200191505060405180910390f35b3480156104b057600080fd5b50610505600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bdb565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105b15780601f10610586576101008083540402835291602001916105b1565b820191906000526020600020905b81548152906001019060200180831161059457829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107825750828110155b151561078d57600080fd5b82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555082600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156108da5782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60016020528060005260406000206000915090505481565b600460009054906101000a900460ff1681565b6002602052816000526040600020602052806000526040600020600091509150505481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a7a5780601f10610a4f57610100808354040283529160200191610a7a565b820191906000526020600020905b815481529060010190602001808311610a5d57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ad257600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820979c62ae45244f66d713b9272cd9a32a6b8c2ba4778ec9fb58a39dc893cb9cde0029' - - const tokenContract = web3.eth.contract(abi) - const contractInstance = await tokenContract.new(supply, name, decimals, ticker, { + async function createToken (owner, { supply, name, decimals, ticker }, isDelayed) { + + const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545/')) + const abi = [ + { + 'constant': true, + 'inputs': [], + 'name': 'name', + 'outputs': [ + { + 'name': '', + 'type': 'string', + }, + ], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function', + }, + { + 'constant': false, + 'inputs': [ + { + 'name': '_spender', + 'type': 'address', + }, + { + 'name': '_value', + 'type': 'uint256', + }, + ], + 'name': 'approve', + 'outputs': [ + { + 'name': 'success', + 'type': 'bool', + }, + ], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function', + }, + { + 'constant': true, + 'inputs': [], + 'name': 'totalSupply', + 'outputs': [ + { + 'name': '', + 'type': 'uint256', + }, + ], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function', + }, + { + 'constant': false, + 'inputs': [ + { + 'name': '_from', + 'type': 'address', + }, + { + 'name': '_to', + 'type': 'address', + }, + { + 'name': '_value', + 'type': 'uint256', + }, + ], + 'name': 'transferFrom', + 'outputs': [ + { + 'name': 'success', + 'type': 'bool', + }, + ], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function', + }, + { + 'constant': true, + 'inputs': [ + { + 'name': '', + 'type': 'address', + }, + ], + 'name': 'balances', + 'outputs': [ + { + 'name': '', + 'type': 'uint256', + }, + ], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function', + }, + { + 'constant': true, + 'inputs': [], + 'name': 'decimals', + 'outputs': [ + { + 'name': '', + 'type': 'uint8', + }, + ], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function', + }, + { + 'constant': true, + 'inputs': [ + { + 'name': '', + 'type': 'address', + }, + { + 'name': '', + 'type': 'address', + }, + ], + 'name': 'allowed', + 'outputs': [ + { + 'name': '', + 'type': 'uint256', + }, + ], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function', + }, + { + 'constant': true, + 'inputs': [ + { + 'name': '_owner', + 'type': 'address', + }, + ], + 'name': 'balanceOf', + 'outputs': [ + { + 'name': 'balance', + 'type': 'uint256', + }, + ], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function', + }, + { + 'constant': true, + 'inputs': [], + 'name': 'symbol', + 'outputs': [ + { + 'name': '', + 'type': 'string', + }, + ], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function', + }, + { + 'constant': false, + 'inputs': [ + { + 'name': '_to', + 'type': 'address', + }, + { + 'name': '_value', + 'type': 'uint256', + }, + ], + 'name': 'transfer', + 'outputs': [ + { + 'name': 'success', + 'type': 'bool', + }, + ], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function', + }, + { + 'constant': true, + 'inputs': [ + { + 'name': '_owner', + 'type': 'address', + }, + { + 'name': '_spender', + 'type': 'address', + }, + ], + 'name': 'allowance', + 'outputs': [ + { + 'name': 'remaining', + 'type': 'uint256', + }, + ], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function', + }, + { + 'inputs': [ + { + 'name': '_initialAmount', + 'type': 'uint256', + }, + { + 'name': '_tokenName', + 'type': 'string', + }, + { + 'name': '_decimalUnits', + 'type': 'uint8', + }, + { + 'name': '_tokenSymbol', + 'type': 'string', + }, + ], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'constructor', + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'name': '_from', + 'type': 'address', + }, + { + 'indexed': true, + 'name': '_to', + 'type': 'address', + }, + { + 'indexed': false, + 'name': '_value', + 'type': 'uint256', + }, + ], + 'name': 'Transfer', + 'type': 'event', + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'name': '_owner', + 'type': 'address', + }, + { + 'indexed': true, + 'name': '_spender', + 'type': 'address', + }, + { + 'indexed': false, + 'name': '_value', + 'type': 'uint256', + }, + ], + 'name': 'Approval', + 'type': 'event', + }, + ] + const bin = '608060405234801561001057600080fd5b50604051610e30380380610e308339810180604052810190808051906020019092919080518201929190602001805190602001909291908051820192919050505083600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508360008190555082600390805190602001906100b29291906100ee565b5081600460006101000a81548160ff021916908360ff16021790555080600590805190602001906100e49291906100ee565b5050505050610193565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061012f57805160ff191683800117855561015d565b8280016001018555821561015d579182015b8281111561015c578251825591602001919060010190610141565b5b50905061016a919061016e565b5090565b61019091905b8082111561018c576000816000905550600101610174565b5090565b90565b610c8e806101a26000396000f3006080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d457806327e235e314610259578063313ce567146102b05780635c658165146102e157806370a082311461035857806395d89b41146103af578063a9059cbb1461043f578063dd62ed3e146104a4575b600080fd5b3480156100c057600080fd5b506100c961051b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b9565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106ab565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061029a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061094b565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c5610963565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102ed57600080fd5b50610342600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610976565b6040518082815260200191505060405180910390f35b34801561036457600080fd5b50610399600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061099b565b6040518082815260200191505060405180910390f35b3480156103bb57600080fd5b506103c46109e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104045780820151818401526020810190506103e9565b50505050905090810190601f1680156104315780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561044b57600080fd5b5061048a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a82565b604051808215151515815260200191505060405180910390f35b3480156104b057600080fd5b50610505600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bdb565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105b15780601f10610586576101008083540402835291602001916105b1565b820191906000526020600020905b81548152906001019060200180831161059457829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107825750828110155b151561078d57600080fd5b82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555082600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156108da5782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60016020528060005260406000206000915090505481565b600460009054906101000a900460ff1681565b6002602052816000526040600020602052806000526040600020600091509150505481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a7a5780601f10610a4f57610100808354040283529160200191610a7a565b820191906000526020600020905b815481529060010190602001808311610a5d57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610ad257600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a72305820979c62ae45244f66d713b9272cd9a32a6b8c2ba4778ec9fb58a39dc893cb9cde0029' + + const tokenContract = web3.eth.contract(abi) + const contractInstance = await tokenContract.new(supply, name, decimals, ticker, { data: bin, from: owner, gas: 4500000, function (err, tokenContract) { - if (err) { - console.log('Error of token creation: ' + err) - } - }, + if (err) { + console.log('Error of token creation: ' + err) + } + }, }) - if (isDelayed) await delay(5000) - return contractInstance.address - } + if (isDelayed) await delay(5000) + return contractInstance.address + } - async function executeTransferMethod (executor) { - try { + async function executeTransferMethod (executor) { + try { const buttonExecute = await waitUntilShowUp(screens.executeMethod.buttonExecuteMethod) assert.notEqual(buttonExecute, false, "button doesn't displayed") await buttonExecute.click() @@ -3079,8 +3084,7 @@ describe('Metamask popup page', async function () { } catch (err) { return false } - } - -}) + } + }) From 0b2fb888122b8aaef4952532b62c25f50c64f031 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 28 Dec 2018 23:04:53 +0300 Subject: [PATCH 6/6] catch in getAllOwners --- old-ui/app/components/send/choose-contract-executor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/old-ui/app/components/send/choose-contract-executor.js b/old-ui/app/components/send/choose-contract-executor.js index d1c293b4b961..5eb0a67d451a 100644 --- a/old-ui/app/components/send/choose-contract-executor.js +++ b/old-ui/app/components/send/choose-contract-executor.js @@ -167,6 +167,10 @@ class ChooseContractExecutor extends Component { this.props.hideLoadingIndication() resolve() }) + .catch(_ => { + this.props.hideLoadingIndication() + resolve() + }) }) }