fix debugger test

pull/5370/head
filip mertens 3 years ago
parent 0b864493fe
commit 410627236d
  1. 2
      apps/remix-ide-e2e/src/commands/clearTransactions.ts
  2. 42
      apps/remix-ide-e2e/src/tests/debugger.spec.ts
  3. 2
      libs/remix-debug/src/debugger/stepManager.ts
  4. 2
      package.json

@ -3,7 +3,7 @@ import EventEmitter from 'events'
class clearTransactions extends EventEmitter { class clearTransactions extends EventEmitter {
command (this: NightwatchBrowser): NightwatchBrowser { command (this: NightwatchBrowser): NightwatchBrowser {
this.api.clickLaunchIcon('udapp').waitForElementPresent('*[data-id="universalDappUiUdappClose"]').click('*[data-id="universalDappUiUdappClose"]').perform((done) => { this.api.clickLaunchIcon('udapp').waitForElementPresent('*[data-id="universalDappUiUdappClose"]').pause(500).click('*[data-id="universalDappUiUdappClose"]').perform((done) => {
done() done()
this.emit('complete') this.emit('complete')
}) })

@ -12,16 +12,17 @@ module.exports = {
return sources return sources
}, },
'Should launch debugger': !function (browser: NightwatchBrowser) { 'Should launch debugger': function (browser: NightwatchBrowser) {
browser.addFile('blah.sol', sources[0]['blah.sol']) browser.addFile('blah.sol', sources[0]['blah.sol'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 65000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 65000)
.click('*[title="Deploy - transact (not payable)"]') .click('*[title="Deploy - transact (not payable)"]')
.debugTransaction(0) .debugTransaction(0)
.waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000) .waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000)
.clearConsole()
}, },
'Should debug failing transaction': !function (browser: NightwatchBrowser) { 'Should debug failing transaction': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="universalDappUiTitleExpander"]') .waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
@ -29,14 +30,14 @@ module.exports = {
.scrollAndClick('*[title="string name, uint256 goal"]') .scrollAndClick('*[title="string name, uint256 goal"]')
.setValue('*[title="string name, uint256 goal"]', '"toast", 999') .setValue('*[title="string name, uint256 goal"]', '"toast", 999')
.click('*[data-id="createProject - transact (not payable)"]') .click('*[data-id="createProject - transact (not payable)"]')
.debugTransaction(1) .debugTransaction(0)
.pause(2000) .pause(2000)
.scrollAndClick('*[data-id="solidityLocals"]') .scrollAndClick('*[data-id="solidityLocals"]')
.waitForElementContainsText('*[data-id="solidityLocals"]', 'toast', 60000) .waitForElementContainsText('*[data-id="solidityLocals"]', 'toast', 60000)
.waitForElementContainsText('*[data-id="solidityLocals"]', '999', 60000) .waitForElementContainsText('*[data-id="solidityLocals"]', '999', 60000)
}, },
'Should debug transaction using slider': !function (browser: NightwatchBrowser) { 'Should debug transaction using slider': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.waitForElementVisible('*[data-id="slider"]') .waitForElementVisible('*[data-id="slider"]')
// eslint-disable-next-line dot-notation // eslint-disable-next-line dot-notation
@ -48,7 +49,7 @@ module.exports = {
.waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n51', 60000) .waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n51', 60000)
}, },
'Should step back and forward transaction': !function (browser: NightwatchBrowser) { 'Should step back and forward transaction': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]') browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.waitForElementPresent('*[data-id="buttonNavigatorIntoBack"]') .waitForElementPresent('*[data-id="buttonNavigatorIntoBack"]')
.scrollAndClick('*[data-id="buttonNavigatorIntoBack"]') .scrollAndClick('*[data-id="buttonNavigatorIntoBack"]')
@ -61,7 +62,7 @@ module.exports = {
.waitForElementContainsText('*[data-id="stepdetail"]', 'execution step:\n51', 60000) .waitForElementContainsText('*[data-id="stepdetail"]', 'execution step:\n51', 60000)
}, },
'Should jump through breakpoints': !function (browser: NightwatchBrowser) { 'Should jump through breakpoints': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#editorView') browser.waitForElementVisible('#editorView')
.execute(() => { .execute(() => {
(window as any).addRemixBreakpoint(11) (window as any).addRemixBreakpoint(11)
@ -80,15 +81,17 @@ module.exports = {
.waitForElementContainsText('*[data-id="stepdetail"]', 'execution step:\n352', 60000) .waitForElementContainsText('*[data-id="stepdetail"]', 'execution step:\n352', 60000)
}, },
'Should display solidity imported code while debugging github import': !function (browser: NightwatchBrowser) { 'Should display solidity imported code while debugging github import': function (browser: NightwatchBrowser) {
browser browser
.clearConsole()
.clearTransactions()
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('externalImport.sol', sources[1]['externalImport.sol'], ['ERC20']) .testContracts('externalImport.sol', sources[1]['externalImport.sol'], ['ERC20'])
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000) .waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000)
.selectContract('ERC20') .selectContract('ERC20')
.createContract('"tokenName", "symbol"') .createContract('"tokenName", "symbol"')
.debugTransaction(2) .debugTransaction(0)
.pause(2000) .pause(2000)
.waitForElementVisible('#stepdetail') .waitForElementVisible('#stepdetail')
.goToVMTraceStep(10) .goToVMTraceStep(10)
@ -101,13 +104,14 @@ module.exports = {
}) })
}, },
'Should display correct source highlighting while debugging a contract which has ABIEncoderV2': !function (browser: NightwatchBrowser) { 'Should display correct source highlighting while debugging a contract which has ABIEncoderV2': function (browser: NightwatchBrowser) {
/* /*
localVariable_step266_ABIEncoder and localVariable_step717_ABIEncoder localVariable_step266_ABIEncoder and localVariable_step717_ABIEncoder
still contains unwanted values (related to decoding calldata types) still contains unwanted values (related to decoding calldata types)
This is still an issue @todo(https://github.com/ethereum/remix-project/issues/481), so this test will fail when this issue is fixed This is still an issue @todo(https://github.com/ethereum/remix-project/issues/481), so this test will fail when this issue is fixed
*/ */
browser browser
.clearConsole().clearTransactions()
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js') .setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js')
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
@ -116,9 +120,10 @@ module.exports = {
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.selectContract('test') .selectContract('test')
.createContract('') .createContract('')
.clickInstance(2) .clearConsole()
.clickInstance(0)
.clickFunction('test1 - transact (not payable)', { types: 'bytes userData', values: '0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000015b38da6a701c568545dcfcb03fcb875f56beddc4' }) .clickFunction('test1 - transact (not payable)', { types: 'bytes userData', values: '0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000015b38da6a701c568545dcfcb03fcb875f56beddc4' })
.debugTransaction(4) .debugTransaction(0)
.pause(2000) .pause(2000)
.waitForElementVisible('#stepdetail') .waitForElementVisible('#stepdetail')
.goToVMTraceStep(261) .goToVMTraceStep(261)
@ -138,11 +143,10 @@ module.exports = {
.goToVMTraceStep(717) .goToVMTraceStep(717)
.pause(5000) .pause(5000)
.checkVariableDebug('soliditylocals', localVariable_step717_ABIEncoder) // all locals should be initiaed .checkVariableDebug('soliditylocals', localVariable_step717_ABIEncoder) // all locals should be initiaed
.clickLaunchIcon('udapp') .clearTransactions()
.clickInstance(2)
}, },
'Should load more solidity locals array': !function (browser: NightwatchBrowser) { 'Should load more solidity locals array': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.testContracts('locals.sol', sources[3]['locals.sol'], ['testLocals']) .testContracts('locals.sol', sources[3]['locals.sol'], ['testLocals'])
@ -155,10 +159,10 @@ module.exports = {
.clickFunction('t - transact (not payable)') .clickFunction('t - transact (not payable)')
.pause(2000) .pause(2000)
.debugTransaction(0) .debugTransaction(0)
.waitForElementVisible('*[data-id="slider"]') .waitForElementVisible('*[data-id="slider"]').pause(2000)
// .setValue('*[data-id="slider"]', '5000') // Like this, setValue doesn't work properly for input type = range // .setValue('*[data-id="slider"]', '5000') // Like this, setValue doesn't work properly for input type = range
// eslint-disable-next-line dot-notation // eslint-disable-next-line dot-notation
.execute(function () { document.getElementById('slider')['value'] = '7450' }) // It only moves slider to 7450 but vm traces are not updated .execute(function () { document.getElementById('slider')['value'] = '7450' }).pause(10000) // It only moves slider to 7450 but vm traces are not updated
.setValue('*[data-id="slider"]', new Array(3).fill(browser.Keys.RIGHT_ARROW)) // This will press NEXT 3 times and will update the trace details .setValue('*[data-id="slider"]', new Array(3).fill(browser.Keys.RIGHT_ARROW)) // This will press NEXT 3 times and will update the trace details
.waitForElementPresent('*[data-id="treeViewDivtreeViewItemarray"]') .waitForElementPresent('*[data-id="treeViewDivtreeViewItemarray"]')
.click('*[data-id="treeViewDivtreeViewItemarray"]') .click('*[data-id="treeViewDivtreeViewItemarray"]')
@ -167,7 +171,7 @@ module.exports = {
.waitForElementContainsText('*[data-id="solidityLocals"]', '9: 9 uint256', 60000) .waitForElementContainsText('*[data-id="solidityLocals"]', '9: 9 uint256', 60000)
.notContainsText('*[data-id="solidityLocals"]', '10: 10 uint256') .notContainsText('*[data-id="solidityLocals"]', '10: 10 uint256')
.clearTransactions() .clearTransactions()
.clearConsole() .clearConsole().pause(2000)
}, },
'Should debug using generated sources': function (browser: NightwatchBrowser) { 'Should debug using generated sources': function (browser: NightwatchBrowser) {
@ -192,7 +196,7 @@ module.exports = {
.click('*[data-id="debuggerTransactionStartButton"]') .click('*[data-id="debuggerTransactionStartButton"]')
}, },
'Should call the debugger api: getTrace': !function (browser: NightwatchBrowser) { 'Should call the debugger api: getTrace': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsGetTrace.js', { content: jsGetTrace }) .addFile('test_jsGetTrace.js', { content: jsGetTrace })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')
@ -200,7 +204,7 @@ module.exports = {
.waitForElementContainsText('*[data-id="terminalJournal"]', '{"gas":"0x575f","return":"0x0000000000000000000000000000000000000000000000000000000000000000","structLogs":', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', '{"gas":"0x575f","return":"0x0000000000000000000000000000000000000000000000000000000000000000","structLogs":', 60000)
}, },
'Should call the debugger api: debug': !function (browser: NightwatchBrowser) { 'Should call the debugger api: debug': function (browser: NightwatchBrowser) {
browser browser
.addFile('test_jsDebug.js', { content: jsDebug }) .addFile('test_jsDebug.js', { content: jsDebug })
.executeScript('remix.exeCurrent()') .executeScript('remix.exeCurrent()')

@ -82,9 +82,7 @@ export class DebuggerStepManager {
} }
const jumpOutDisabled = (step === this.traceManager.findStepOut(step)) const jumpOutDisabled = (step === this.traceManager.findStepOut(step))
setTimeout(() => {
this.event.trigger('stepChanged', [step, stepState, jumpOutDisabled]) this.event.trigger('stepChanged', [step, stepState, jumpOutDisabled])
}, 100)
}) })
} }

@ -82,7 +82,7 @@
"nightwatch_local_publishContract": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/publishContract.test.js --env=chrome", "nightwatch_local_publishContract": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/publishContract.test.js --env=chrome",
"nightwatch_local_generalSettings": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/generalSettings.test.js --env=chrome", "nightwatch_local_generalSettings": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/generalSettings.test.js --env=chrome",
"nightwatch_local_fileExplorer": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/fileExplorer.test.js --env=chrome", "nightwatch_local_fileExplorer": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/fileExplorer.test.js --env=chrome",
"nightwatch_local_debugger": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/debugger.spec.js --env=chrome", "nightwatch_local_debugger": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/debugger.spec.js --env=firefox",
"nightwatch_local_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/editor.spec.js --env=chrome", "nightwatch_local_editor": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/editor.spec.js --env=chrome",
"nightwatch_local_compiler": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/compiler_api.test.js --env=chrome", "nightwatch_local_compiler": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/compiler_api.test.js --env=chrome",
"nightwatch_local_txListener": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/txListener.test.js --env=chrome", "nightwatch_local_txListener": "npm run build:e2e && nightwatch --config dist/apps/remix-ide-e2e/nightwatch.js dist/apps/remix-ide-e2e/src/tests/txListener.test.js --env=chrome",

Loading…
Cancel
Save