Merge pull request #2613 from ethereum/transaction-log-test

Improved Transaction Log Test
pull/1/head
yann300 5 years ago committed by GitHub
commit 63b6b54b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/components/vertical-icons.js
  2. 2
      src/app/panels/terminal.js
  3. 2
      src/app/tabs/runTab/contractDropdown.js
  4. 2
      src/app/tabs/runTab/settings.js
  5. 2
      src/app/udapp/run-tab.js
  6. 7
      src/app/ui/multiParamManager.js
  7. 62
      src/app/ui/txLogger.js
  8. 3
      src/app/ui/universal-dapp-ui.js
  9. 2
      test-browser/commands/goToVMTraceStep.js
  10. 82
      test-browser/commands/testFunction.js
  11. 44
      test-browser/tests/ballot.js
  12. 190
      test-browser/tests/transactionExecution.js

@ -262,7 +262,7 @@ export class VerticalIcons extends Plugin {
` `
this.iconKind['debugging'] = yo` this.iconKind['debugging'] = yo`
<div id='debuggingIcons'> <div id='debuggingIcons' data-id="verticalIconsDebuggingIcons">
</div> </div>
` `

@ -165,7 +165,7 @@ class Terminal extends Plugin {
${self._view.dragbar} ${self._view.dragbar}
<div class="${css.menu} border-top border-dark bg-light" data-id="terminalToggleMenu"> <div class="${css.menu} border-top border-dark bg-light" data-id="terminalToggleMenu">
${self._view.icon} ${self._view.icon}
<div class=${css.clear} id="clearConsole" onclick=${clear}> <div class=${css.clear} id="clearConsole" data-id="terminalClearConsole" onclick=${clear}>
<i class="fas fa-ban" aria-hidden="true" title="Clear console" <i class="fas fa-ban" aria-hidden="true" title="Clear console"
onmouseenter=${hover} onmouseleave=${hover}></i> onmouseenter=${hover} onmouseleave=${hover}></i>
</div> </div>

@ -54,7 +54,7 @@ class ContractDropdownUI {
this.createPanel = yo`<div class="${css.deployDropdown}"></div>` this.createPanel = yo`<div class="${css.deployDropdown}"></div>`
this.orLabel = yo`<div class="${css.orLabel}">or</div>` this.orLabel = yo`<div class="${css.orLabel}">or</div>`
let el = yo` let el = yo`
<div class="${css.container}"> <div class="${css.container}" data-id="contractDropdownContainer">
<label class="${css.settingsLabel}">Contract</label> <label class="${css.settingsLabel}">Contract</label>
<div class="${css.subcontainer}"> <div class="${css.subcontainer}">
${this.selectContractNames} ${this.compFails} ${info} ${this.selectContractNames} ${this.compFails} ${info}

@ -69,7 +69,7 @@ class SettingsUI {
title="Execution environment has been provided by Metamask or similar provider." title="Execution environment has been provided by Metamask or similar provider."
value="injected" name="executionContext"> Injected Web3 value="injected" name="executionContext"> Injected Web3
</option> </option>
<option id="web3-mode" <option id="web3-mode" data-id="settingsWeb3Mode"
title="Execution environment connects to node at localhost (or via IPC if available), transactions will be sent to the network and can cause loss of money or worse! title="Execution environment connects to node at localhost (or via IPC if available), transactions will be sent to the network and can cause loss of money or worse!
If this page is served via https and you access your node via http, it might not work. In this case, try cloning the repository and serving it via http." If this page is served via https and you access your node via http, it might not work. In this case, try cloning the repository and serving it via http."
value="web3" name="executionContext"> Web3 Provider value="web3" name="executionContext"> Web3 Provider

@ -47,7 +47,7 @@ export class RunTab extends LibraryPlugin {
} }
renderContainer () { renderContainer () {
this.container = yo`<div class="${css.runTabView} run-tab" id="runTabView" ></div>` this.container = yo`<div class="${css.runTabView} run-tab" id="runTabView" data-id="runTabView"></div>`
var el = yo` var el = yo`
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">

@ -100,7 +100,7 @@ class MultiParamManager {
if (this.funABI.inputs) { if (this.funABI.inputs) {
return yo`<div> return yo`<div>
${this.funABI.inputs.map(function (inp) { ${this.funABI.inputs.map(function (inp) {
return yo`<div class="${css.multiArg}"><label for="${inp.name}"> ${inp.name}: </label><input class="form-control" placeholder="${inp.type}" title="${inp.name}"></div>` return yo`<div class="${css.multiArg}"><label for="${inp.name}"> ${inp.name}: </label><input class="form-control" placeholder="${inp.type}" title="${inp.name}" data-id="multiParamManagerInput${inp.name}"></div>`
})} })}
</div>` </div>`
} }
@ -119,7 +119,7 @@ class MultiParamManager {
this.basicInputField = yo`<input class="form-control"></input>` this.basicInputField = yo`<input class="form-control"></input>`
this.basicInputField.setAttribute('placeholder', this.inputs) this.basicInputField.setAttribute('placeholder', this.inputs)
this.basicInputField.setAttribute('title', this.inputs) this.basicInputField.setAttribute('title', this.inputs)
this.basicInputField.setAttribute('data-id', this.inputs) this.basicInputField.setAttribute('data-id', `multiParamManagerBasicInputField${this.inputs}`)
var onClick = () => { var onClick = () => {
this.clickCallBack(this.funABI.inputs, this.basicInputField.value) this.clickCallBack(this.funABI.inputs, this.basicInputField.value)
@ -184,6 +184,7 @@ class MultiParamManager {
expandedButton.setAttribute('title', (title + ' - call')) expandedButton.setAttribute('title', (title + ' - call'))
expandedButton.innerHTML = 'call' expandedButton.innerHTML = 'call'
expandedButton.classList.add('btn-info') expandedButton.classList.add('btn-info')
expandedButton.setAttribute('data-id', (title + ' - call'))
funcButton.setAttribute('title', (title + ' - call')) funcButton.setAttribute('title', (title + ' - call'))
funcButton.classList.add('btn-info') funcButton.classList.add('btn-info')
funcButton.setAttribute('data-id', (title + ' - call')) funcButton.setAttribute('data-id', (title + ' - call'))
@ -192,6 +193,7 @@ class MultiParamManager {
expandedButton.setAttribute('title', (title + ' - transact (payable)')) expandedButton.setAttribute('title', (title + ' - transact (payable)'))
expandedButton.innerHTML = 'transact' expandedButton.innerHTML = 'transact'
expandedButton.classList.add('btn-danger') expandedButton.classList.add('btn-danger')
expandedButton.setAttribute('data-id', (title + ' - transact (payable)'))
funcButton.setAttribute('title', (title + ' - transact (payable)')) funcButton.setAttribute('title', (title + ' - transact (payable)'))
funcButton.classList.add('btn-danger') funcButton.classList.add('btn-danger')
funcButton.setAttribute('data-id', (title + ' - transact (payable)')) funcButton.setAttribute('data-id', (title + ' - transact (payable)'))
@ -200,6 +202,7 @@ class MultiParamManager {
expandedButton.setAttribute('title', (title + ' - transact (not payable)')) expandedButton.setAttribute('title', (title + ' - transact (not payable)'))
expandedButton.innerHTML = 'transact' expandedButton.innerHTML = 'transact'
expandedButton.classList.add('btn-warning') expandedButton.classList.add('btn-warning')
expandedButton.setAttribute('data-id', (title + ' - transact (not payable)'))
funcButton.classList.add('btn-warning') funcButton.classList.add('btn-warning')
funcButton.setAttribute('title', (title + ' - transact (not payable)')) funcButton.setAttribute('title', (title + ' - transact (not payable)'))
funcButton.setAttribute('data-id', (title + ' - transact (not payable)')) funcButton.setAttribute('data-id', (title + ' - transact (not payable)'))

@ -210,12 +210,12 @@ function renderKnownTransaction (self, data, blockchain) {
var obj = {from, to} var obj = {from, to}
var txType = 'knownTx' var txType = 'knownTx'
var tx = yo` var tx = yo`
<span id="tx${data.tx.hash}"> <span id="tx${data.tx.hash}" data-id="txLogger${data.tx.hash}">
<div class="${css.log}" onclick=${e => txDetails(e, tx, data, obj)}> <div class="${css.log}" onclick=${e => txDetails(e, tx, data, obj)}>
${checkTxStatus(data.receipt, txType)} ${checkTxStatus(data.receipt, txType)}
${context(self, {from, to, data}, blockchain)} ${context(self, {from, to, data}, blockchain)}
<div class=${css.buttons}> <div class=${css.buttons}>
<button data-shared="txLoggerDebugButton" class="${css.debug} btn btn-primary btn-sm" onclick=${(e) => debug(e, data, self)}>Debug</div> <button class="${css.debug} btn btn-primary btn-sm" data-shared="txLoggerDebugButton" data-id="txLoggerDebugButton${data.tx.hash}" onclick=${(e) => debug(e, data, self)}>Debug</div>
</div> </div>
<i class="${css.arrow} fas fa-angle-down"></i> <i class="${css.arrow} fas fa-angle-down"></i>
</div> </div>
@ -384,7 +384,7 @@ function txDetails (e, tx, data, obj) {
} }
function createTable (opts) { function createTable (opts) {
var table = yo`<table class="${css.txTable}" id="txTable"></table>` var table = yo`<table class="${css.txTable}" id="txTable" data-id="txLoggerTable${opts.hash}"></table>`
if (!opts.isCall) { if (!opts.isCall) {
var msg = '' var msg = ''
if (opts.status !== undefined && opts.status !== null) { if (opts.status !== undefined && opts.status !== null) {
@ -398,15 +398,15 @@ function createTable (opts) {
} }
table.appendChild(yo` table.appendChild(yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> status </td> <td class="${css.td}" data-shared="key_${opts.hash}"> status </td>
<td class="${css.td}">${opts.status}${msg}</td> <td class="${css.td}" data-id="txLoggerTableStatus${opts.hash}" data-shared="pair_${opts.hash}">${opts.status}${msg}</td>
</tr>`) </tr>`)
} }
var transactionHash = yo` var transactionHash = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> transaction hash </td> <td class="${css.td}" data-shared="key_${opts.hash}"> transaction hash </td>
<td class="${css.td}">${opts.hash} <td class="${css.td}" data-id="txLoggerTableHash${opts.hash}" data-shared="pair_${opts.hash}">${opts.hash}
${copyToClipboard(() => opts.hash)} ${copyToClipboard(() => opts.hash)}
</td> </td>
</tr> </tr>
@ -415,8 +415,8 @@ function createTable (opts) {
var contractAddress = yo` var contractAddress = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> contract address </td> <td class="${css.td}" data-shared="key_${opts.hash}"> contract address </td>
<td class="${css.td}">${opts.contractAddress} <td class="${css.td}" data-id="txLoggerTableContractAddress${opts.hash}" data-shared="pair_${opts.hash}">${opts.contractAddress}
${copyToClipboard(() => opts.contractAddress)} ${copyToClipboard(() => opts.contractAddress)}
</td> </td>
</tr> </tr>
@ -425,8 +425,8 @@ function createTable (opts) {
var from = yo` var from = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td} ${css.tableTitle}"> from </td> <td class="${css.td} ${css.tableTitle}" data-shared="key_${opts.hash}"> from </td>
<td class="${css.td}">${opts.from} <td class="${css.td}" data-id="txLoggerTableFrom${opts.hash}" data-shared="pair_${opts.hash}">${opts.from}
${copyToClipboard(() => opts.from)} ${copyToClipboard(() => opts.from)}
</td> </td>
</tr> </tr>
@ -442,8 +442,8 @@ function createTable (opts) {
} }
var to = yo` var to = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> to </td> <td class="${css.td}" data-shared="key_${opts.hash}"> to </td>
<td class="${css.td}">${toHash} <td class="${css.td}" data-id="txLoggerTableTo${opts.hash}" data-shared="pair_${opts.hash}">${toHash}
${copyToClipboard(() => data.to ? data.to : toHash)} ${copyToClipboard(() => data.to ? data.to : toHash)}
</td> </td>
</tr> </tr>
@ -452,8 +452,8 @@ function createTable (opts) {
var gas = yo` var gas = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> gas </td> <td class="${css.td}" data-shared="key_${opts.hash}"> gas </td>
<td class="${css.td}">${opts.gas} gas <td class="${css.td}" data-id="txLoggerTableGas${opts.hash}" data-shared="pair_${opts.hash}">${opts.gas} gas
${copyToClipboard(() => opts.gas)} ${copyToClipboard(() => opts.gas)}
</td> </td>
</tr> </tr>
@ -467,8 +467,8 @@ function createTable (opts) {
if (opts.transactionCost) { if (opts.transactionCost) {
table.appendChild(yo` table.appendChild(yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> transaction cost </td> <td class="${css.td}" data-shared="key_${opts.hash}"> transaction cost </td>
<td class="${css.td}">${opts.transactionCost} gas ${callWarning} <td class="${css.td}" data-id="txLoggerTableTransactionCost${opts.hash}" data-shared="pair_${opts.hash}">${opts.transactionCost} gas ${callWarning}
${copyToClipboard(() => opts.transactionCost)} ${copyToClipboard(() => opts.transactionCost)}
</td> </td>
</tr>`) </tr>`)
@ -477,8 +477,8 @@ function createTable (opts) {
if (opts.executionCost) { if (opts.executionCost) {
table.appendChild(yo` table.appendChild(yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> execution cost </td> <td class="${css.td}" data-shared="key_${opts.hash}"> execution cost </td>
<td class="${css.td}">${opts.executionCost} gas ${callWarning} <td class="${css.td}" data-id="txLoggerTableExecutionHash${opts.hash}" data-shared="pair_${opts.hash}">${opts.executionCost} gas ${callWarning}
${copyToClipboard(() => opts.executionCost)} ${copyToClipboard(() => opts.executionCost)}
</td> </td>
</tr>`) </tr>`)
@ -486,8 +486,8 @@ function createTable (opts) {
var hash = yo` var hash = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> hash </td> <td class="${css.td}" data-shared="key_${opts.hash}"> hash </td>
<td class="${css.td}">${opts.hash} <td class="${css.td}" data-id="txLoggerTableHash${opts.hash}" data-shared="pair_${opts.hash}">${opts.hash}
${copyToClipboard(() => opts.hash)} ${copyToClipboard(() => opts.hash)}
</td> </td>
</tr> </tr>
@ -496,8 +496,8 @@ function createTable (opts) {
var input = yo` var input = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> input </td> <td class="${css.td}" data-shared="key_${opts.hash}"> input </td>
<td class="${css.td}">${helper.shortenHexData(opts.input)} <td class="${css.td}" data-id="txLoggerTableInput${opts.hash}" data-shared="pair_${opts.hash}">${helper.shortenHexData(opts.input)}
${copyToClipboard(() => opts.input)} ${copyToClipboard(() => opts.input)}
</td> </td>
</tr> </tr>
@ -507,8 +507,8 @@ function createTable (opts) {
if (opts['decoded input']) { if (opts['decoded input']) {
var inputDecoded = yo` var inputDecoded = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> decoded input </td> <td class="${css.td}" data-shared="key_${opts.hash}"> decoded input </td>
<td class="${css.td}">${opts['decoded input']} <td class="${css.td}" data-id="txLoggerTableDecodedInput${opts.hash}" data-shared="pair_${opts.hash}">${opts['decoded input']}
${copyToClipboard(() => opts['decoded input'])} ${copyToClipboard(() => opts['decoded input'])}
</td> </td>
</tr>` </tr>`
@ -518,8 +518,8 @@ function createTable (opts) {
if (opts['decoded output']) { if (opts['decoded output']) {
var outputDecoded = yo` var outputDecoded = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> decoded output </td> <td class="${css.td}" data-shared="key_${opts.hash}"> decoded output </td>
<td class="${css.td}" id="decodedoutput" >${opts['decoded output']} <td class="${css.td}" id="decodedoutput" data-id="txLoggerTableDecodedOutput${opts.hash}" data-shared="pair_${opts.hash}">${opts['decoded output']}
${copyToClipboard(() => opts['decoded output'])} ${copyToClipboard(() => opts['decoded output'])}
</td> </td>
</tr>` </tr>`
@ -532,8 +532,8 @@ function createTable (opts) {
} }
var logs = yo` var logs = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> logs </td> <td class="${css.td}" data-shared="key_${opts.hash}"> logs </td>
<td class="${css.td}" id="logs"> <td class="${css.td}" id="logs" data-id="txLoggerTableLogs${opts.hash}" data-shared="pair_${opts.hash}">
${JSON.stringify(stringified, null, '\t')} ${JSON.stringify(stringified, null, '\t')}
${copyToClipboard(() => JSON.stringify(stringified, null, '\t'))} ${copyToClipboard(() => JSON.stringify(stringified, null, '\t'))}
${copyToClipboard(() => JSON.stringify(opts.logs.raw || '0'))} ${copyToClipboard(() => JSON.stringify(opts.logs.raw || '0'))}
@ -545,8 +545,8 @@ function createTable (opts) {
var val = opts.val != null ? typeConversion.toInt(opts.val) : 0 var val = opts.val != null ? typeConversion.toInt(opts.val) : 0
val = yo` val = yo`
<tr class="${css.tr}"> <tr class="${css.tr}">
<td class="${css.td}"> value </td> <td class="${css.td}" data-shared="key_${opts.hash}"> value </td>
<td class="${css.td}">${val} wei <td class="${css.td}" data-id="txLoggerTableValue${opts.hash}" data-shared="pair_${opts.hash}">${val} wei
${copyToClipboard(() => `${val} wei`)} ${copyToClipboard(() => `${val} wei`)}
</td> </td>
</tr> </tr>

@ -79,6 +79,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
var close = yo` var close = yo`
<button <button
class="${css.udappClose} p-1 btn btn-secondary" class="${css.udappClose} p-1 btn btn-secondary"
data-id="universalDappUiUdappClose"
onclick=${remove} onclick=${remove}
title="Remove from the list" title="Remove from the list"
> >
@ -87,7 +88,7 @@ UniversalDAppUI.prototype.renderInstanceFromABI = function (contractABI, address
title.querySelector('.btn-group').appendChild(close) title.querySelector('.btn-group').appendChild(close)
var contractActionsWrapper = yo` var contractActionsWrapper = yo`
<div class="${css.cActionsWrapper}"> <div class="${css.cActionsWrapper}" data-id="universalDappUiContractActionWrapper">
</div> </div>
` `

@ -28,7 +28,7 @@ function goToVMtraceStep (browser, step, incr, done) {
browser.click('#intoforward') browser.click('#intoforward')
.perform(() => { .perform(() => {
setTimeout(() => { setTimeout(() => {
goToVMtraceStep(browser, step, done, incr) goToVMtraceStep(browser, step, incr, done)
}, 200) }, 200)
}) })
} }

@ -2,49 +2,55 @@ const EventEmitter = require('events')
const deepequal = require('deep-equal') const deepequal = require('deep-equal')
class TestFunction extends EventEmitter { class TestFunction extends EventEmitter {
command (fnFullName, txHash, log, expectedInput, expectedReturn, expectedEvent, callback) { command (txHash, expectedValue) {
this.api.waitForElementPresent('.instance button[title="' + fnFullName + '"]') const browser = this.api
.perform(function (client, done) { const logs = {}
client.execute(function () { const setLog = (index, value) => { logs[Object.keys(logs)[index]] = value }
document.querySelector('#runTabView').scrollTop = document.querySelector('#runTabView').scrollHeight
}, [], function () { browser.waitForElementVisible(`*[data-id="txLogger${txHash}"]`)
if (expectedInput) { .click(`*[data-id="txLogger${txHash}"]`)
client.setValue('#runTabView input[title="' + expectedInput.types + '"]', expectedInput.values, function () {}) .waitForElementVisible(`*[data-id="txLoggerTable${txHash}"]`)
} .click(`*[data-id="txLoggerTable${txHash}"]`)
done()
// fetch and format transaction logs as key => pair object
.elements('css selector', `*[data-shared="key_${txHash}"]`, (res) => {
res.value.forEach(function (jsonWebElement) {
const jsonWebElementId = jsonWebElement.ELEMENT
browser.elementIdText(jsonWebElementId, (jsonElement) => {
const key = jsonElement.value.trim()
logs[key] = null
})
}) })
}) })
.click('.instance button[title="' + fnFullName + '"]') .elements('css selector', `*[data-shared="pair_${txHash}"]`, (res) => {
.pause(500) res.value.forEach(function (jsonWebElement, index) {
.waitForElementPresent('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"]') const jsonWebElementId = jsonWebElement.ELEMENT
.assert.containsText('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"] span', log)
.click('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"] div[class^="log"]') browser.elementIdText(jsonWebElementId, (jsonElement) => {
.perform(function (client, done) { let value = jsonElement.value
if (expectedReturn) {
client.getText('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #decodedoutput', (result) => { try {
console.log(result) value = JSON.parse(jsonElement.value)
var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedReturn)) setLog(index, value)
if (!equal) { } catch (e) {
client.assert.fail('expected ' + expectedReturn + ' got ' + result.value, 'info about error', '') setLog(index, value)
} }
}) })
} })
done()
}) })
.perform((client, done) => {
if (expectedEvent) { browser.perform(() => {
client.getText('#main-panel div[class^="terminal"] span[id="tx' + txHash + '"] table[class^="txTable"] #logs', (result) => { Object.keys(expectedValue).forEach(key => {
console.log(result) const equal = deepequal(logs[key], expectedValue[key])
var equal = deepequal(JSON.parse(result.value), JSON.parse(expectedEvent))
if (!equal) { if (!equal) {
client.assert.fail('expected ' + expectedEvent + ' got ' + result.value, 'info about error', '') browser.assert.fail(`Expected ${expectedValue[key]} but got ${logs[key]}`)
} } else {
}) browser.assert.ok(true, `Expected value matched returned value ${expectedValue[key]}`)
} }
done() })
if (callback) {
callback.call(this.api)
}
this.emit('complete') this.emit('complete')
}) })
return this return this

@ -16,26 +16,30 @@ module.exports = {
}, },
'Deploy Ballot': function (browser) { 'Deploy Ballot': function (browser) {
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c') .selectAccount('0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('#runTabView button[class^="instanceButton"]') .click('*[data-id="Deploy - transact (not payable)"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('.instance:nth-of-type(2) > div > button') .click('*[data-id="universalDappUiTitleExpander"]')
.testFunction('delegate - transact (not payable)', '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3', .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'})
`[vm]\nfrom:0xca3...a733c\nto:Ballot.delegate(address) 0x692...77b3a\nvalue:0 wei\ndata:0x5c1...4d2db\nlogs:0\nhash:0x41f...c31b3`, .testFunction('0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
{types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}, null, null) {
status: '0x1 Transaction mined and execution succeed',
'transaction hash': '0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
})
}, },
'Debug Ballot / delegate': function (browser) { 'Debug Ballot / delegate': function (browser) {
browser.pause(500) browser.pause(500)
.click('span#tx0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3 button[class^="debug"]') .click('*[data-id="txLoggerDebugButton0x41fab8ea5b1d9fba5e0a6545ca1a2d62fff518578802c033c2b9a031a01c31b3"]')
.pause(2000) .pause(2000)
.clickLaunchIcon('debugger') .clickLaunchIcon('debugger')
.click('#jumppreviousbreakpoint') .click('*[data-id="buttonNavigatorJumpPreviousBreakpoint"]')
.pause(2000) .pause(2000)
.goToVMTraceStep(79) .goToVMTraceStep(79)
.pause(1000) .pause(1000)
@ -45,30 +49,34 @@ module.exports = {
'Access Ballot via at address': function (browser) { 'Access Ballot via at address': function (browser) {
browser.clickLaunchIcon('udapp') browser.clickLaunchIcon('udapp')
.click('button[class^="udappClose"]') .click('*[data-id="universalDappUiUdappClose"]')
.addFile('ballot.abi', { content: ballotABI }) .addFile('ballot.abi', { content: ballotABI })
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false) .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3B', true, false)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true) .addAtAddressInstance('0x692a70D2e424a56D2C6C27aA97D1a86395877b3A', true, true)
.pause(500) .pause(500)
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('*[data-id="universalDappUiContractActionWrapper"]')
.click('.instance:nth-of-type(2) > div > button') .click('*[data-id="universalDappUiTitleExpander"]')
.testFunction('delegate - transact (not payable)', '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803', .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'})
`[vm]\nfrom:0xca3...a733c\nto:Ballot.delegate(address) 0x692...77b3a\nvalue:0 wei\ndata:0x5c1...4d2db\nlogs:0\nhash:0xca5...5c803`, .testFunction('0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
{types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}, null, null) {
status: '0x0 Transaction mined but execution failed',
'transaction hash': '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
'decoded input': { 'address to': '0x4B0897b0513fdC7C541B6d9D7E929C4e5364D2dB' }
})
}, },
'Deploy and use Ballot using external web3': function (browser) { 'Deploy and use Ballot using external web3': function (browser) {
browser browser
.click('#selectExEnvOptions #web3-mode') .click('*[data-id="settingsWeb3Mode"]')
.modalFooterOKClick() .modalFooterOKClick()
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot']) .testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]') .setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('#runTabView button[class^="instanceButton"]') .click('*[data-id="Deploy - transact (not payable)"]')
.clickInstance(0) .clickInstance(0)
.click('#clearConsole') .click('*[data-id="terminalClearConsole"]')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'}) .clickFunction('delegate - transact (not payable)', {types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'})
.journalLastChildIncludes('Ballot.delegate(address)') .journalLastChildIncludes('Ballot.delegate(address)')
.journalLastChildIncludes('data:0x5c1...a733c') .journalLastChildIncludes('data:0x5c1...a733c')

@ -19,22 +19,27 @@ module.exports = {
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.click('#runTabView .instance div[class^="title"]') .click('#runTabView .instance div[class^="title"]')
.click('#runTabView .instance div[class^="title"]') .click('#runTabView .instance div[class^="title"]')
.testFunction('f - transact (not payable)', .clickFunction('f - transact (not payable)')
'0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03', .testFunction('0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03',
`[vm]\nfrom:0xca3...a733c\nto:TestContract.f() 0x692...77b3a\nvalue:0 wei\ndata:0x261...21ff0\nlogs:0\nhash:0x38b...53e03`, null, {
`{ status: '0x1 Transaction mined and execution succeed',
"0": "uint256: 8" 'transaction hash': '0x38bb944fa4709ed9e163d6c670259f97284b4defd916d512a2fcc3f35bb53e03',
}`) 'decoded output': { '0': 'uint256: 8' }
})
.pause(500) .pause(500)
.checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '') .checkTerminalFilter('0x12332162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92782', '')
.testFunction('g - transact (not payable)', .clickFunction('g - transact (not payable)')
'0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0', .testFunction('0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0',
`[vm]\nfrom:0xca3...a733c\nto:TestContract.g() 0x692...77b3a\nvalue:0 wei\ndata:0xe21...79b8e\nlogs:0\nhash:0xab4...500f0`, null, `{ {
"0": "uint256: 345", status: '0x1 Transaction mined and execution succeed',
"1": "string: comment_comment_", 'transaction hash': '0xab4f794ca0b531f27fc6eace623666b440facbf20e77615a057d728c67b500f0',
"2": "bool: true", 'decoded output': {
"3": "uint256: 4" '0': 'uint256: 345',
}`) '1': 'string: comment_comment_',
'2': 'bool: true',
'3': 'uint256: 4'
}
})
.click('i[class^="clearinstance"]') .click('i[class^="clearinstance"]')
}, },
@ -44,35 +49,46 @@ module.exports = {
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.testFunction('retunValues1 - transact (not payable)', .clickFunction('retunValues1 - transact (not payable)')
'0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d', .testFunction('0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d',
`[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues1() 0x5e7...26e9f\nvalue:0 wei\ndata:0x9ed...59eb7\nlogs:0\nhash:0x09c...ee39d`, {
null, status: '0x1 Transaction mined and execution succeed',
`{ 'transaction hash': '0x09c6716a67f0f8c7a0ca2b3ddf59c25982da856a95aefd640b767f9b9feee39d',
"0": "bool: _b true", 'decoded output': {
"1": "uint256: _u 345", '0': 'bool: _b true',
"2": "int256: _i -345", '1': 'uint256: _u 345',
"3": "address: _a 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" '2': 'int256: _i -345',
}`) '3': 'address: _a 0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'
.testFunction('retunValues2 - transact (not payable)', }
'0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf', })
`[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues2() 0x5e7...26e9f\nvalue:0 wei\ndata:0xf57...4036c\nlogs:0\nhash:0xe88...fb6bf`, null, `{ .clickFunction('retunValues2 - transact (not payable)')
"0": "bytes1: _b 0x12", .testFunction('0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf',
"1": "bytes2: _b2 0x1223", {
"2": "bytes3: _b3 0x000000", status: '0x1 Transaction mined and execution succeed',
"3": "bytes: _blit 0x123498", 'transaction hash': '0xe884953e0695399d60914af3e1ea2dad59fe41f3c0c20665c130fa40dd0fb6bf',
"4": "bytes5: _b5 0x0432450000", 'decoded output': {
"5": "bytes6: _b6 0x234553253200", '0': 'bytes1: _b 0x12',
"6": "string: _str this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string", '1': 'bytes2: _b2 0x1223',
"7": "bytes7: _b7 0x03252353253253", '2': 'bytes3: _b3 0x000000',
"8": "bytes22: _b22 0x32523523532532532523532500000000000000000000", '3': 'bytes: _blit 0x123498',
"9": "bytes32: _b32 0x0325235325325235325235325235320000000000000000000000000000000000" '4': 'bytes5: _b5 0x0432450000',
}`).pause(500).testFunction('retunValues3 - transact (not payable)', '5': 'bytes6: _b6 0x234553253200',
'0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5', '6': 'string: _str this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string _ this is a long string',
'[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues3() 0x5e7...26e9f\nvalue:0 wei\ndata:0x033...e0a7d\nlogs:0\nhash:0xb41...67eb5', null, `{ '7': 'bytes7: _b7 0x03252353253253',
"0": "uint8: _en 2", '8': 'bytes22: _b22 0x32523523532532532523532500000000000000000000',
"1": "int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7" '9': 'bytes32: _b32 0x0325235325325235325235325235320000000000000000000000000000000000'
}`).click('i[class^="clearinstance"]') }
}).pause(500)
.clickFunction('retunValues3 - transact (not payable)')
.testFunction('0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5',
{
status: '0x1 Transaction mined and execution succeed',
'transaction hash': '0xb4108649d5e65a4a0776d6ac98c2c356540a7e99d641705a82352a845d467eb5',
'decoded output': {
'0': 'uint8: _en 2',
'1': 'int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7'
}
}).click('i[class^="clearinstance"]')
}, },
'Test Complex Input Values': function (browser) { 'Test Complex Input Values': function (browser) {
@ -81,49 +97,53 @@ module.exports = {
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
.click('.instance:nth-of-type(2) > div > button') .click('.instance:nth-of-type(2) > div > button')
.testFunction('inputValue1 - transact (not payable)', .clickFunction('inputValue1 - transact (not payable)', {types: 'uint256 _u, int256 _i, string _str', values: '"2343242", "-4324324", "string _ string _ string _ string _ string _ string _ string _ string _ string _ string _"'})
'0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97', .testFunction('0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97',
`[vm]\nfrom:0xca3...a733c\nto:test.inputValue1(uint256,int256,string) 0x8c1...401f5\nvalue:0 wei\ndata:0xd69...00000\nlogs:0\nhash:0xe96...f5b97`, {
{types: 'uint256 _u, int256 _i, string _str', values: '"2343242", "-4324324", "string _ string _ string _ string _ string _ string _ string _ string _ string _ string _"'}, status: '0x1 Transaction mined and execution succeed',
`{ 'transaction hash': '0xe9678b5486674a0425301a1d7e925c22cfb9f7f7ec6242697d742009f7ef5b97',
"0": "uint256: _uret 2343242", 'decoded output': {
"1": "int256: _iret -4324324", '0': 'uint256: _uret 2343242',
"2": "string: _strret string _ string _ string _ string _ string _ string _ string _ string _ string _ string _" '1': 'int256: _iret -4324324',
}`) '2': 'string: _strret string _ string _ string _ string _ string _ string _ string _ string _ string _ string _'
}
})
.pause(500) .pause(500)
.testFunction('inputValue2 - transact (not payable)', .clickFunction('inputValue2 - transact (not payable)', {types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234000000000000", "0x1234000000000000","0x1234000000000000","0x1234000000000000"]'})
'0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f', .testFunction('0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f', {
`[vm]\nfrom:0xca3...a733c\nto:test.inputValue2(uint256[3],bytes8[4]) 0x8c1...401f5\nvalue:0 wei\ndata:0x1b7...00000\nlogs:1\nhash:0x217...a321f`, status: '0x1 Transaction mined and execution succeed',
{types: 'uint256[3] _n, bytes8[4] _b8', values: '[1,2,3], ["0x1234000000000000", "0x1234000000000000","0x1234000000000000","0x1234000000000000"]'}, 'transaction hash': '0x21724b08c3699bda8375803f8dc842194aea370f2aac284e55144b452dca321f',
`{ 'decoded output': {
"0": "uint256[3]: _nret 1,2,3", '0': 'uint256[3]: _nret 1,2,3',
"1": "bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000" '1': 'bytes8[4]: _b8ret 0x1234000000000000,0x1234000000000000,0x1234000000000000,0x1234000000000000'
}`, `[ },
{ logs: [
"from": "0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5", {
"topic": "0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f", 'from': '0x8c1ed7e19abaa9f23c476da86dc1577f1ef401f5',
"event": "event1", 'topic': '0xd30981760edbf605bda8689e945f622877f230c9a77cbfbd448aa4b7d8ac6e7f',
"args": { 'event': 'event1',
"0": "-123", 'args': {
"1": "123", '0': '-123',
"2": { '1': '123',
"hash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658", '2': {
"type": "Indexed" 'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
}, 'type': 'Indexed'
"3": "0x12340000", },
"4": "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ", '3': '0x12340000',
"_i": "-123", '4': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ',
"_u": "123", '_i': '-123',
"_str": { '_u': '123',
"hash": "0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658", '_str': {
"type": "Indexed" 'hash': '0x9c22ff5f21f0b81b113e63f7db6da94fedef11b2119b4088b89664fb9a3cb658',
}, 'type': 'Indexed'
"_b": "0x12340000", },
"_notIndexed": "test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ", '_b': '0x12340000',
"length": 5 '_notIndexed': 'test _ test _ test _ test test _ test test _ test test _ test test _ test test _ test test _ test ',
} 'length': 5
} }
]`) }
]
})
.click('i[class^="clearinstance"]') .click('i[class^="clearinstance"]')
.end() .end()
}, },

Loading…
Cancel
Save