Debug Transaction Command

pull/5370/head
ioedeveloper 5 years ago committed by yann300
parent 324abe33ce
commit cb62c5b6b5
  1. 11
      src/app/ui/multiParamManager.js
  2. 2
      src/app/ui/txLogger.js
  3. 25
      test-browser/commands/debugTransaction.js
  4. 10
      test-browser/tests/debugger.js

@ -116,14 +116,15 @@ class MultiParamManager {
title = this.funABI.type === 'receive' ? '(receive)' : '(fallback)' title = this.funABI.type === 'receive' ? '(receive)' : '(fallback)'
} }
this.basicInputField = yo`<input class="form-control" data-shared="multiParamManagerBasicInputField"></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)
var onClick = () => { var onClick = () => {
this.clickCallBack(this.funABI.inputs, this.basicInputField.value) this.clickCallBack(this.funABI.inputs, this.basicInputField.value)
} }
let funcButton = yo`<button onclick=${() => onClick()} data-shared="multiParamManagerFuncButton" class="${css.instanceButton} btn btn-sm">${title}</button>` let funcButton = yo`<button onclick=${() => onClick()} class="${css.instanceButton} btn btn-sm">${title}</button>`
this.contractActionsContainerSingle = yo` this.contractActionsContainerSingle = yo`
<div class="${css.contractActionsContainerSingle} pt-2"> <div class="${css.contractActionsContainerSingle} pt-2">
${funcButton} ${funcButton}
@ -142,7 +143,7 @@ class MultiParamManager {
} }
} }
var expandedButton = yo`<button onclick=${() => { multiOnClick() }} class="${css.instanceButton}" data-shared="multiParamManagerExpandedButton"></button>` var expandedButton = yo`<button onclick=${() => { multiOnClick() }} class="${css.instanceButton}"></button>`
this.contractActionsContainerMulti = yo`<div class="${css.contractActionsContainerMulti}" > this.contractActionsContainerMulti = yo`<div class="${css.contractActionsContainerMulti}" >
<div class="${css.contractActionsContainerMultiInner} text-dark" > <div class="${css.contractActionsContainerMultiInner} text-dark" >
@ -185,6 +186,7 @@ class MultiParamManager {
expandedButton.classList.add('btn-info') expandedButton.classList.add('btn-info')
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'))
} else if (this.funABI.stateMutability === 'payable' || this.funABI.payable) { } else if (this.funABI.stateMutability === 'payable' || this.funABI.payable) {
// transact. stateMutability = payable // transact. stateMutability = payable
expandedButton.setAttribute('title', (title + ' - transact (payable)')) expandedButton.setAttribute('title', (title + ' - transact (payable)'))
@ -192,6 +194,7 @@ class MultiParamManager {
expandedButton.classList.add('btn-danger') expandedButton.classList.add('btn-danger')
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)'))
} else { } else {
// transact. stateMutability = nonpayable // transact. stateMutability = nonpayable
expandedButton.setAttribute('title', (title + ' - transact (not payable)')) expandedButton.setAttribute('title', (title + ' - transact (not payable)'))
@ -199,6 +202,7 @@ class MultiParamManager {
expandedButton.classList.add('btn-warning') expandedButton.classList.add('btn-warning')
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)'))
} }
if (this.funABI.inputs && this.funABI.inputs.length > 0) { if (this.funABI.inputs && this.funABI.inputs.length > 0) {
@ -207,6 +211,7 @@ class MultiParamManager {
contractProperty.classList.add(css.hasArgs) contractProperty.classList.add(css.hasArgs)
this.basicInputField.setAttribute('title', `'(${this.funABI.type}')`) // probably should pass name instead this.basicInputField.setAttribute('title', `'(${this.funABI.type}')`) // probably should pass name instead
this.contractActionsContainerSingle.querySelector('i').style.visibility = 'hidden' this.contractActionsContainerSingle.querySelector('i').style.visibility = 'hidden'
this.basicInputField.setAttribute('data-id', `'(${this.funABI.type}')`)
} else { } else {
this.contractActionsContainerSingle.querySelector('i').style.visibility = 'hidden' this.contractActionsContainerSingle.querySelector('i').style.visibility = 'hidden'
this.basicInputField.style.visibility = 'hidden' this.basicInputField.style.visibility = 'hidden'

@ -205,7 +205,7 @@ function log (self, tx, receipt) {
} }
function renderKnownTransaction (self, data, blockchain) { function renderKnownTransaction (self, data, blockchain) {
var from = data.tx.from var from = data.tx.from
var to = data.resolvedData.contractName + '.' + data.resolvedData.fn var to = data.resolvedData.contractName + '.' + data.resolvedData.fn
var obj = {from, to} var obj = {from, to}
var txType = 'knownTx' var txType = 'knownTx'

@ -0,0 +1,25 @@
const EventEmitter = require('events')
class debugTransaction extends EventEmitter {
command (index = 0) {
this.api.perform((done) => {
checkStyle(this.api, index, () => {
done()
this.emit('complete')
})
})
return this
}
}
function checkStyle (browser, index, callback) {
browser.pause(2000).execute(function (index) {
const debugBtn = document.querySelectorAll('*[data-shared="txLoggerDebugButton"]')[index]
debugBtn.click()
}, [index], function () {
callback()
})
}
module.exports = debugTransaction

@ -17,8 +17,7 @@ module.exports = {
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]') .waitForElementPresent('*[title="Deploy - transact (not payable)"]')
.click('*[title="Deploy - transact (not payable)"]') .click('*[title="Deploy - transact (not payable)"]')
.waitForElementPresent('*[data-shared="txLoggerDebugButton"]:nth-of-type(1)') .debugTransaction(0)
.click('*[data-shared="txLoggerDebugButton"]:nth-of-type(1)')
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER') .assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER')
}, },
@ -27,9 +26,10 @@ module.exports = {
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
.click('*[data-id="universalDappUiTitleExpander"]') .click('*[data-id="universalDappUiTitleExpander"]')
.waitForElementPresent('*[data-shared="multiParamManagerBasicInputField"]:nth-of-type(1)') .scrollAndClick('*[title="string name, uint256 goal"]')
.sendKeys('*[data-shared="multiParamManagerBasicInputField"]:nth-of-type(1)', '"toast", 999') .setValue('*[title="string name, uint256 goal"]', '"toast", 999')
.pause(100000) .click('*[data-id="createProject - transact (not payable)"]')
.debugTransaction(1)
.end() .end()
}, },

Loading…
Cancel
Save