diff --git a/package.json b/package.json index aac26fff09..f65512b676 100644 --- a/package.json +++ b/package.json @@ -186,6 +186,7 @@ "nightwatch_local_debugger": "nightwatch ./test-browser/tests/debugger.test.js --config nightwatch.js --env chrome ", "nightwatch_local_editor": "nightwatch ./test-browser/tests/editor.test.js --config nightwatch.js --env chrome ", "nightwatch_local_compiler": "nightwatch ./test-browser/tests/compiler_api.test.js --config nightwatch.js --env chrome ", + "nightwatch_local_txListener": "nightwatch ./test-browser/tests/txListener.test.js --config nightwatch.js --env chrome ", "nightwatch_local_runAndDeploy": "nightwatch ./test-browser/tests/runAndDeploy.js --config nightwatch.js --env chrome-runAndDeploy ", "onchange": "onchange build/app.js -- npm-run-all lint", "prepublish": "mkdirp build; npm-run-all -ls downloadsolc_root build", diff --git a/test-browser/tests/specialFunctions.test.js b/test-browser/tests/specialFunctions.test.js index 53b6af7ddb..862fd2534c 100644 --- a/test-browser/tests/specialFunctions.test.js +++ b/test-browser/tests/specialFunctions.test.js @@ -4,6 +4,12 @@ var sauce = require('./sauce') module.exports = { before: function (browser, done) { + // this test suite also contribute testing https://github.com/ethereum/remix/pull/1497 and https://github.com/ethereum/remix-ide/pull/2898 + // quick explanation: + // the goal of https://github.com/ethereum/remix-ide/pull/2898 is to keep track of all the compiled contracts an not only the last one. + // this introduce an issue: if 2 compiled contracts have the same name, the second one override the first which is not wanted. + // fix's delivered by https://github.com/ethereum/remix/pull/1497: instead of getting contract by name, + // which result in name clashing we process the whole contract object (which contain bytecode, deployedbytecode, ...) init(browser, done) }, '@sources': function () { diff --git a/test-browser/tests/txListener.test.js b/test-browser/tests/txListener.test.js new file mode 100644 index 0000000000..4dfbdb502b --- /dev/null +++ b/test-browser/tests/txListener.test.js @@ -0,0 +1,52 @@ +'use strict' +var examples = require('../../src/app/editor/example-contracts') +var init = require('../helpers/init') +var sauce = require('./sauce') + +var sources = [ + {'browser/Untitled.sol': {content: examples.ballot.content}}, + {'browser/Untitled1.sol': {content: `contract test {}`}} +] + +module.exports = { + before: function (browser, done) { + init(browser, done) + }, + '@sources': function () { + return sources + }, + 'The sequence: Compiling / Deploying / Compiling another contract / calling the first contract - should display in the log the transaction with all the decoded information': function (browser) { + // https://github.com/ethereum/remix-ide/issues/2864 + browser + .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) + .clickLaunchIcon('solidity') + .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) + .clickLaunchIcon('udapp') + .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') + .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') + .click('*[data-id="Deploy - transact (not payable)"]') + .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]') + .click('*[data-id="universalDappUiTitleExpander"]') + .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}) + .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', + { + status: '0x1 Transaction mined and execution succeed', + 'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', + 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + }) + .clickLaunchIcon('solidity') + .testContracts('Untitled1.sol', sources[1]['browser/Untitled1.sol'], ['test']) + .clickLaunchIcon('udapp') + .clickFunction('delegate - transact (not payable)', {types: 'address to', values: ''}) + .pause(5000) + .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', + { + status: '0x0 Transaction mined but execution failed', + 'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', + 'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' } + }) + .end() + }, + + tearDown: sauce +}