update debug tests

pull/1754/head
filip mertens 3 years ago
parent 5641ce0a2f
commit 3a48a8fcd6
  1. 8
      .circleci/config.yml
  2. 1
      .gitignore
  3. 11
      apps/remix-ide-e2e/nightwatch.ts
  4. 14
      apps/remix-ide-e2e/src/commands/clearConsole.ts
  5. 24
      apps/remix-ide-e2e/src/commands/clearTransactions.ts
  6. 65
      apps/remix-ide-e2e/src/tests/debugger.spec.ts
  7. 1
      apps/remix-ide-e2e/src/tests/solidityUnittests.spec.ts
  8. 2
      apps/remix-ide-e2e/src/types/index.d.ts
  9. 2
      package.json

@ -107,7 +107,7 @@ jobs:
- COMMIT_AUTHOR: "Circle CI"
working_directory: ~/remix-project
parallelism: 14
parallelism: 20
steps:
- browser-tools/install-browser-tools
- checkout
@ -144,7 +144,7 @@ jobs:
- COMMIT_AUTHOR: "Circle CI"
working_directory: ~/remix-project
parallelism: 13
parallelism: 20
steps:
- browser-tools/install-browser-tools
- checkout
@ -181,7 +181,7 @@ jobs:
- COMMIT_AUTHOR: "Circle CI"
working_directory: ~/remix-project
parallelism: 14
parallelism: 20
steps:
- browser-tools/install-browser-tools
- checkout
@ -218,7 +218,7 @@ jobs:
- COMMIT_AUTHOR: "Circle CI"
working_directory: ~/remix-project
parallelism: 13
parallelism: 20
steps:
- browser-tools/install-browser-tools
- checkout

1
.gitignore vendored

@ -12,6 +12,7 @@ docs/_build
TODO
soljson.js
*~
*_group*.*.ts
# compiled output

@ -47,6 +47,17 @@ module.exports = {
}
},
chromeDesktop: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
'goog:chromeOptions': {
args: ['window-size=2560,1440', 'start-fullscreen', '--no-sandbox']
}
}
},
'chrome-runAndDeploy': {
desiredCapabilities: {
browserName: 'chrome',

@ -0,0 +1,14 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'
class clearConsole extends EventEmitter {
command (this: NightwatchBrowser): NightwatchBrowser {
this.api.waitForElementVisible('*[data-id="terminalCli"]').click('#clearConsole').perform((done) => {
done()
this.emit('complete')
})
return this
}
}
module.exports = clearConsole

@ -0,0 +1,24 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'
class clearTransactions extends EventEmitter {
command (this: NightwatchBrowser): NightwatchBrowser {
const browser = this
this.api.clickLaunchIcon('udapp').element('css selector', '*[data-id="universalDappUiUdappClose"]', function (visible: any) {
if (visible.status && visible.status === -1) {
browser.api.perform((done) => {
done()
browser.emit('complete')
})
} else {
browser.api.pause(500).click('*[data-id="universalDappUiUdappClose"]').perform((done) => {
done()
browser.emit('complete')
})
}
})
return this
}
}
module.exports = clearTransactions

@ -12,16 +12,17 @@ module.exports = {
return sources
},
'Should launch debugger ': function (browser: NightwatchBrowser) {
'Should launch debugger #group1': function (browser: NightwatchBrowser) {
browser.addFile('blah.sol', sources[0]['blah.sol'])
.clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 65000)
.click('*[title="Deploy - transact (not payable)"]')
.debugTransaction(0)
.waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000)
.clearConsole()
},
'Should debug failing transaction ': function (browser: NightwatchBrowser) {
'Should debug failing transaction #group1': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.clickLaunchIcon('udapp')
.waitForElementPresent('*[data-id="universalDappUiTitleExpander"]')
@ -29,14 +30,14 @@ module.exports = {
.scrollAndClick('*[title="string name, uint256 goal"]')
.setValue('*[title="string name, uint256 goal"]', '"toast", 999')
.click('*[data-id="createProject - transact (not payable)"]')
.debugTransaction(1)
.debugTransaction(0)
.pause(2000)
.scrollAndClick('*[data-id="solidityLocals"]')
.waitForElementContainsText('*[data-id="solidityLocals"]', 'toast', 60000)
.waitForElementContainsText('*[data-id="solidityLocals"]', '999', 60000)
},
'Should debug transaction using slider ': function (browser: NightwatchBrowser) {
'Should debug transaction using slider #group1': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.waitForElementVisible('*[data-id="slider"]')
// eslint-disable-next-line dot-notation
@ -48,7 +49,7 @@ module.exports = {
.waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n51', 60000)
},
'Should step back and forward transaction ': function (browser: NightwatchBrowser) {
'Should step back and forward transaction #group1': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindudapp"]')
.waitForElementPresent('*[data-id="buttonNavigatorIntoBack"]')
.scrollAndClick('*[data-id="buttonNavigatorIntoBack"]')
@ -61,7 +62,7 @@ module.exports = {
.waitForElementContainsText('*[data-id="stepdetail"]', 'execution step:\n51', 60000)
},
'Should jump through breakpoints ': function (browser: NightwatchBrowser) {
'Should jump through breakpoints #group1': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('#editorView')
.execute(() => {
(window as any).addRemixBreakpoint(11)
@ -80,15 +81,17 @@ module.exports = {
.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 #group2': function (browser: NightwatchBrowser) {
browser
.clearConsole()
.clearTransactions()
.clickLaunchIcon('solidity')
.testContracts('externalImport.sol', sources[1]['externalImport.sol'], ['ERC20'])
.clickLaunchIcon('udapp')
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 35000)
.selectContract('ERC20')
.createContract('"tokenName", "symbol"')
.debugTransaction(2)
.debugTransaction(0)
.pause(2000)
.waitForElementVisible('#stepdetail')
.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 #group2': function (browser: NightwatchBrowser) {
/*
localVariable_step266_ABIEncoder and localVariable_step717_ABIEncoder
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
*/
browser
.clearConsole().clearTransactions()
.clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.6.12+commit.27d51765.js')
.clickLaunchIcon('filePanel')
@ -116,9 +120,10 @@ module.exports = {
.clickLaunchIcon('udapp')
.selectContract('test')
.createContract('')
.clickInstance(2)
.clearConsole()
.clickInstance(0)
.clickFunction('test1 - transact (not payable)', { types: 'bytes userData', values: '0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000015b38da6a701c568545dcfcb03fcb875f56beddc4' })
.debugTransaction(4)
.debugTransaction(0)
.pause(2000)
.waitForElementVisible('#stepdetail')
.goToVMTraceStep(261)
@ -138,11 +143,10 @@ module.exports = {
.goToVMTraceStep(717)
.pause(5000)
.checkVariableDebug('soliditylocals', localVariable_step717_ABIEncoder) // all locals should be initiaed
.clickLaunchIcon('udapp')
.clickInstance(2)
.clearTransactions()
},
'Should load more solidity locals array ': function (browser: NightwatchBrowser) {
'Should load more solidity locals array #group3': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('solidity')
.testContracts('locals.sol', sources[3]['locals.sol'], ['testLocals'])
@ -150,32 +154,37 @@ module.exports = {
.waitForElementPresent('*[title="Deploy - transact (not payable)"]', 40000)
.createContract('')
.pause(2000)
.clickInstance(3)
.clearConsole()
.clickInstance(0)
.clickFunction('t - transact (not payable)')
.pause(2000)
.debugTransaction(6)
.waitForElementVisible('*[data-id="slider"]')
.debugTransaction(0)
.waitForElementVisible('*[data-id="slider"]').pause(2000)
// .setValue('*[data-id="slider"]', '5000') // Like this, setValue doesn't work properly for input type = range
// 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
.waitForElementPresent('*[data-id="treeViewDivtreeViewItemarray"]')
.click('*[data-id="treeViewDivtreeViewItemarray"]')
.waitForElementPresent('*[data-id="treeViewDivtreeViewLoadMore"]')
.waitForElementVisible('*[data-id="solidityLocals"]')
.waitForElementContainsText('*[data-id="solidityLocals"]', '9: 9 uint256', 60000)
.notContainsText('*[data-id="solidityLocals"]', '10: 10 uint256')
.clearTransactions()
.clearConsole().pause(2000)
},
'Should debug using generated sources ': function (browser: NightwatchBrowser) {
'Should debug using generated sources #group4': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('solidity')
.pause(2000)
.testContracts('withGeneratedSources.sol', sources[4]['withGeneratedSources.sol'], ['A'])
.clickLaunchIcon('udapp')
.createContract('')
.clickInstance(4)
.clearConsole()
.clickInstance(0)
.clickFunction('f - transact (not payable)', { types: 'uint256[] ', values: '[]' })
.debugTransaction(8)
.debugTransaction(0)
.pause(2000)
.click('*[data-id="debuggerTransactionStartButton"]') // stop debugging
.click('*[data-id="debugGeneratedSourcesLabel"]') // select debug with generated sources
@ -186,16 +195,16 @@ module.exports = {
})
.click('*[data-id="debuggerTransactionStartButton"]')
},
'Should call the debugger api: getTrace ': function (browser: NightwatchBrowser) {
// depends on Should debug using generated sources
'Should call the debugger api: getTrace #group4': function (browser: NightwatchBrowser) {
browser
.addFile('test_jsGetTrace.js', { content: jsGetTrace })
.executeScript('remix.exeCurrent()')
.pause(1000)
.waitForElementContainsText('*[data-id="terminalJournal"]', '{"gas":"0x575f","return":"0x0000000000000000000000000000000000000000000000000000000000000000","structLogs":', 60000)
},
'Should call the debugger api: debug ': function (browser: NightwatchBrowser) {
// depends on Should debug using generated sources
'Should call the debugger api: debug #group4': function (browser: NightwatchBrowser) {
browser
.addFile('test_jsDebug.js', { content: jsDebug })
.executeScript('remix.exeCurrent()')
@ -214,7 +223,7 @@ module.exports = {
.waitForElementContainsText('*[data-id="stepdetail"]', 'vm trace step:\n154', 60000)
},
'Should start debugging using remix debug nodes (rinkeby)': '' + function (browser: NightwatchBrowser) {
'Should start debugging using remix debug nodes (rinkeby) #group4': '' + function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.8.7+commit.e28d00a7.js')
@ -428,7 +437,7 @@ const localVariable_step717_ABIEncoder = { // eslint-disable-line
const jsGetTrace = `(async () => {
try {
const result = await remix.call('debugger', 'getTrace', '0x9341be49e911afe99bf1abc67cbcf36739d2e6470a08a69511c205a0737d7332')
const result = await remix.call('debugger', 'getTrace', '0x16be5c31014a7e1552d136f7ed7bc7788f3bb9e45e31b059df253173f2df31e7')
console.log('result ', result)
} catch (e) {
console.log(e.message)
@ -437,7 +446,7 @@ const jsGetTrace = `(async () => {
const jsDebug = `(async () => {
try {
const result = await remix.call('debugger', 'debug', '0x9341be49e911afe99bf1abc67cbcf36739d2e6470a08a69511c205a0737d7332')
const result = await remix.call('debugger', 'debug', '0x16be5c31014a7e1552d136f7ed7bc7788f3bb9e45e31b059df253173f2df31e7')
console.log('result ', result)
} catch (e) {
console.log(e.message)

@ -272,6 +272,7 @@ module.exports = {
.waitForElementContainsText('#solidityUnittestsOutput', '✓ Check winning proposal passed', 60000)
.waitForElementContainsText('#solidityUnittestsOutput', '✘ Check winning proposal again', 60000)
.waitForElementContainsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value', 60000)
.waitForElementVisible('*[data-id="dropdownPanelSolidityLocals"]').pause(1000)
.click('#Check_winning_proposal_failed')
.waitForElementContainsText('*[data-id="sidePanelSwapitTitle"]', 'DEBUGGER', 60000)
.waitForElementContainsText('*[data-id="functionPanel"]', 'checkWinningProposalFailed()', 60000)

@ -59,6 +59,8 @@ declare module 'nightwatch' {
currentWorkspaceIs(name: string): NightwatchBrowser
addLocalPlugin(this: NightwatchBrowser, profile: Profile & LocationProfile & ExternalProfile): NightwatchBrowser
acceptAndRemember (this: NightwatchBrowser, remember: boolean, accept: boolean): NightwatchBrowser
clearConsole (this: NightwatchBrowser): NightwatchBrowser
clearTransactions (this: NightwatchBrowser): NightwatchBrowser
}
export interface NightwatchBrowser {

@ -84,7 +84,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_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_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=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_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