CheckVariableDebug

pull/2868/head
filip mertens 2 years ago
parent 922e90e01b
commit d250de7db7
  1. 29
      apps/remix-ide-e2e/src/commands/checkVariableDebug.ts
  2. 12
      apps/remix-ide-e2e/src/tests/debugger.test.ts

@ -17,22 +17,33 @@ class CheckVariableDebug extends EventEmitter {
function checkDebug(browser: NightwatchBrowser, id: string, debugValue: NightwatchCheckVariableDebugValue, done: VoidFunction) {
// id is soliditylocals or soliditystate
let resultOfElement = null
let isEqual = false
browser.waitUntil(() => {
browser.execute(function (id: string) {
const elem = document.querySelector('#' + id + ' .dropdownrawcontent') as HTMLElement
if (elem && elem.innerText) {
console.log(elem.innerText)
return elem.innerText
}, [id], function (result) {
let value
}
}, [id], (result) => {
if (result.value) {
console.log(JSON.parse(<string>result.value))
try {
value = JSON.parse(<string>result.value)
resultOfElement = JSON.parse(<string>result.value)
isEqual = deepequal(debugValue, resultOfElement)
} catch (e) {
browser.assert.fail('cant parse solidity state', e.message, '')
done()
return
console.log(e)
}
const equal = deepequal(debugValue, value)
if (!equal) {
browser.assert.fail(JSON.stringify(value), 'info about error\n ' + JSON.stringify(debugValue) + '\n ' + JSON.stringify(value), '')
}
})
if (isEqual) return true
return false
}, 10000, 1000)
.perform(() => {
if (!isEqual) {
browser.assert.fail(JSON.stringify(resultOfElement), 'info about error\n ' + JSON.stringify(debugValue) + '\n ' + JSON.stringify(resultOfElement), '')
}
done()
})

@ -133,10 +133,6 @@ module.exports = {
selector: '//*[@data-id="treeViewLivm trace step" and contains(.,"133")]',
})
.goToVMTraceStep(261)
.waitForElementVisible({
locateStrategy: 'xpath',
selector: '//*[@data-id="treeViewLivm trace step" and contains(.,"261")]',
})
.waitForElementPresent('.highlightLine8')
/*
for the test below:
@ -148,16 +144,8 @@ module.exports = {
*/
.goToVMTraceStep(266)
.waitForElementVisible({
locateStrategy: 'xpath',
selector: '//*[@data-id="treeViewLivm trace step" and contains(.,"266")]',
})
.checkVariableDebug('soliditylocals', localVariable_step266_ABIEncoder) // locals should not be initiated at this point, only idAsk should
.goToVMTraceStep(717)
.waitForElementVisible({
locateStrategy: 'xpath',
selector: '//*[@data-id="treeViewLivm trace step" and contains(.,"717")]',
})
.checkVariableDebug('soliditylocals', localVariable_step717_ABIEncoder) // all locals should be initiaed
.clearTransactions()
},

Loading…
Cancel
Save