From 99b3b01bec1cb2fc1ecac8f4e1888d8e98478613 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 25 Apr 2018 11:28:43 +0200 Subject: [PATCH 1/9] logs now is an object instead of array --- src/app/execution/txLogger.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/execution/txLogger.js b/src/app/execution/txLogger.js index c5a2349c3e..76785881a8 100644 --- a/src/app/execution/txLogger.js +++ b/src/app/execution/txLogger.js @@ -264,7 +264,7 @@ function context (self, opts) { var val = data.tx.value var hash = data.tx.hash ? helper.shortenHexData(data.tx.hash) : '' var input = data.tx.input ? helper.shortenHexData(data.tx.input) : '' - var logs = data.logs && data.logs.decoded ? data.logs.decoded.length : 0 + var logs = data.logs && data.logs.decoded && data.logs.decoded.length ? data.logs.decoded.length : 0 var block = data.tx.blockNumber || '' var i = data.tx.transactionIndex var value = val ? typeConversion.toInt(val) : 0 From 09a4147fe84d30ec6cc7934cb235853a6f45ac81 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 25 Apr 2018 11:29:23 +0200 Subject: [PATCH 2/9] improve testing output and event --- test-browser/helpers/contracts.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test-browser/helpers/contracts.js b/test-browser/helpers/contracts.js index ac526ab565..c9b26d9d25 100644 --- a/test-browser/helpers/contracts.js +++ b/test-browser/helpers/contracts.js @@ -135,13 +135,25 @@ function testFunction (fnFullName, txHash, log, expectedInput, expectedReturn, e .click('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] div[class^="log"]') .perform(function (client, done) { if (expectedReturn) { - client.assert.containsText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #decodedoutput', expectedReturn) + client.getText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #decodedoutput', (result) => { + console.log(result) + var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedReturn)) + if (!equal) { + client.assert.fail('expected ' + expectedReturn + ' got ' + result.value, 'info about error', '') + } + }) } done() }) .perform(function (client, done) { if (expectedEvent) { - client.assert.containsText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #logs', expectedEvent) + client.getText('#editor-container div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #logs', (result) => { + console.log(result) + var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedEvent)) + if (!equal) { + client.assert.fail('expected ' + expectedEvent + ' got ' + result.value, 'info about error', '') + } + }) } done() if (callback) callback() From d60ee0aa38d5291d773680ecc15e67b5bc335120 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 25 Apr 2018 11:30:03 +0200 Subject: [PATCH 3/9] decoded values using ethers.js are a bit different --- test-browser/tests/compiling.js | 36 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/test-browser/tests/compiling.js b/test-browser/tests/compiling.js index cb50042549..274a19cc75 100644 --- a/test-browser/tests/compiling.js +++ b/test-browser/tests/compiling.js @@ -78,7 +78,7 @@ function testReturnValues (browser, callback) { "0": "bool: _b true", "1": "uint256: _u 345", "2": "int256: _i -345", - "3": "address: _a 0xca35b7d915458ef540ade6068dfe2f44e8fa733c" + "3": "address: _a 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" }`) .pause(500) .testFunction('retunValues2 - transact (not payable)', @@ -98,7 +98,7 @@ function testReturnValues (browser, callback) { '0x7faab07aeaafc8afe6bf283bb83be70c000dff381dec04e779354e354da14aff', '[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues3() 0x5e7...26e9f\nvalue:0 wei\ndata:0x033...e0a7d\nlogs:0\nhash:0x7fa...14aff', null, `{ "0": "uint8: _en 2", - "1": "int256[5][]: _a1 1,-45,-78,56,60, -1,42,334,-45455,-446, 1,10,-5435,45,-7" + "1": "int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7" }`).click('i[class^="clearinstance"]').perform(() => { callback(null, browser) }) }) } @@ -121,19 +121,31 @@ function testInputValues (browser, callback) { `[vm]\nfrom:0xca3...a733c\nto:test.inputValue2(uint256[3],bytes8[4]) 0x8c1...401f5\nvalue:0 wei\ndata:0x1b7...00000\nlogs:1\nhash:0x487...6ef7f`, {types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234", "0x1234","0x1234","0x1234"]'}, `{ - "0": "uint256[3]: _nret 1, 2, 3", - "1": "bytes8[4]: _b8ret 0x1234000000000000, 0x1234000000000000, 0x1234000000000000, 0x1234000000000000" -}`, `[ + "0": "uint256[3]: _nret 1,2,3", + "1": "bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000" +}`, `"[ { "topic": "d30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f", "event": "event1", - "args": [ - "-123", - "000000000000000000000000000000000000000000000000000000000000007b", - "9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658", - "0x00001234", - "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test " - ] + "args": { + "0": "-123", + "1": "123", + "2": { + "indexed": true, + "hash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658" + }, + "3": "0x00001234", + "4": "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ", + "_i": "-123", + "_u": "123", + "_str": { + "indexed": true, + "hash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658" + }, + "_b": "0x00001234", + "_notIndexed": "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ", + "length": 5 + } } ]`) .click('i[class^="clearinstance"]').perform(() => { callback(null, browser) }) From 2817fe4eed9a024d28f063bdb3a06432410d03b3 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 26 Apr 2018 11:27:30 +0200 Subject: [PATCH 4/9] clear circle cache --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e0c4c60f4b..7fea11d029 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,10 +26,10 @@ jobs: - checkout - restore_cache: keys: - - dep-bundle-7-{{ checksum "package.json" }} + - dep-bundle-8-{{ checksum "package.json" }} - run: npm install - save_cache: - key: dep-bundle-7-{{ checksum "package.json" }} + key: dep-bundle-8-{{ checksum "package.json" }} paths: - ~/repo/node_modules - run: npm run lint && npm run test && npm run downloadsolc && npm run make-mock-compiler && npm run build From ca3eeb09862c71097fa7b0bad54dbc913ae46a33 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 26 Apr 2018 13:24:52 +0200 Subject: [PATCH 5/9] fix test --- test-browser/tests/compiling.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-browser/tests/compiling.js b/test-browser/tests/compiling.js index 274a19cc75..ebc77dea4d 100644 --- a/test-browser/tests/compiling.js +++ b/test-browser/tests/compiling.js @@ -123,7 +123,7 @@ function testInputValues (browser, callback) { `{ "0": "uint256[3]: _nret 1,2,3", "1": "bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000" -}`, `"[ +}`, `[ { "topic": "d30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f", "event": "event1", From dea6cca6282ea4b4c445980c5bc3b7e835d0cd0e Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 26 Apr 2018 13:24:57 +0200 Subject: [PATCH 6/9] clear cache --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7fea11d029..ecf3dfcfff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,10 +26,10 @@ jobs: - checkout - restore_cache: keys: - - dep-bundle-8-{{ checksum "package.json" }} + - dep-bundle-10-{{ checksum "package.json" }} - run: npm install - save_cache: - key: dep-bundle-8-{{ checksum "package.json" }} + key: dep-bundle-10-{{ checksum "package.json" }} paths: - ~/repo/node_modules - run: npm run lint && npm run test && npm run downloadsolc && npm run make-mock-compiler && npm run build From 85c724d0ebd973f70d44af6ce0619c84b2093e39 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 26 Apr 2018 16:59:32 +0200 Subject: [PATCH 7/9] add log --- test-browser/helpers/contracts.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test-browser/helpers/contracts.js b/test-browser/helpers/contracts.js index c9b26d9d25..9ddbf96cc4 100644 --- a/test-browser/helpers/contracts.js +++ b/test-browser/helpers/contracts.js @@ -108,6 +108,7 @@ function verifyCallReturnValue (browser, address, checks, done) { } return ret }, [address], function (result) { + console.log(result) for (var k in checks) { browser.assert.equal(result.value[k], checks[k]) } From bd3925f6eaf07e47e8729ef7f023f8fc4329f8c4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 26 Apr 2018 17:32:44 +0200 Subject: [PATCH 8/9] fix test --- test-browser/tests/units/testRecorder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-browser/tests/units/testRecorder.js b/test-browser/tests/units/testRecorder.js index 2bab7a71c9..3dc481d515 100644 --- a/test-browser/tests/units/testRecorder.js +++ b/test-browser/tests/units/testRecorder.js @@ -16,7 +16,7 @@ module.exports = { .clickFunction('getFromLib - call') .waitForElementPresent('div[class^="contractActionsContainer"] div[class^="value"] ul') .perform((client, done) => { - contractHelper.verifyCallReturnValue(browser, '0x35ef07393b57464e93deb59175ff72e6499450cf', ['0: uint256: 1', '0: uint256: 3456', '0: address: 0x35ef07393b57464e93deb59175ff72e6499450cf'], () => { + contractHelper.verifyCallReturnValue(browser, '0x35ef07393b57464e93deb59175ff72e6499450cf', ['0: uint256: 1', '0: uint256: 3456', '0: address: 0x35eF07393b57464e93dEB59175fF72E6499450cF'], () => { done() }) }) From 55773aab484c9a14d259ba1113acc5a0472a3031 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 26 Apr 2018 18:24:05 +0200 Subject: [PATCH 9/9] remove console.log --- test-browser/helpers/contracts.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test-browser/helpers/contracts.js b/test-browser/helpers/contracts.js index 9ddbf96cc4..c9b26d9d25 100644 --- a/test-browser/helpers/contracts.js +++ b/test-browser/helpers/contracts.js @@ -108,7 +108,6 @@ function verifyCallReturnValue (browser, address, checks, done) { } return ret }, [address], function (result) { - console.log(result) for (var k in checks) { browser.assert.equal(result.value[k], checks[k]) }