e2e tests for filtering analysis

pull/5370/head
Aniket-Engg 3 years ago committed by yann300
parent d3b475d628
commit 641294934a
  1. 28
      apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts
  2. 2
      libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

@ -30,6 +30,27 @@ module.exports = {
},
'Static Analysis': function (browser: NightwatchBrowser) {
runTests(browser)
},
'run analysis and filter results': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('filePanel')
.click('*[data-id="treeViewLitreeViewItemcontracts"]')
.click('*[data-id="treeViewLitreeViewItemcontracts/2_Owner.sol"]')
.clickLaunchIcon('solidity')
.pause(10000)
.clickLaunchIcon('solidityStaticAnalysis')
.waitForElementPresent('#staticanalysisresult .warning', 5000)
.assert.containsText('#verticalIconsKindsolidityStaticAnalysis .remixui_status', '1') // Check warning count
.verify.elementPresent('input[name="showLibWarnings"]')
.verify.elementNotPresent('input[name="showLibWarnings"]:checked')
.verify.elementPresent('label[id="headingshowLibWarnings"]')
.click('label[id="headingshowLibWarnings"]')
.pause(1000)
.assert.containsText('#verticalIconsKindsolidityStaticAnalysis .remixui_status', '382')
.click('label[id="headingshowLibWarnings"]')
.pause(1000)
.assert.containsText('#verticalIconsKindsolidityStaticAnalysis .remixui_status', '1')
.end()
}
}
@ -47,14 +68,12 @@ function runTests (browser: NightwatchBrowser) {
'TooMuchGas.() : Variables have very similar names "test" and "test1".',
'TooMuchGas.() : Variables have very similar names "test" and "test1".'],
'#staticanalysisresult .warning',
browser, function () {
browser.end()
}
browser
)
})
}
function listSelectorContains (textsToFind: string[], selector: string, browser: NightwatchBrowser, callback: VoidFunction) {
function listSelectorContains (textsToFind: string[], selector: string, browser: NightwatchBrowser) {
browser.execute(function (selector) {
const items = document.querySelectorAll(selector)
const ret = []
@ -68,6 +87,5 @@ function listSelectorContains (textsToFind: string[], selector: string, browser:
console.log('testing `' + result.value[k] + '` against `' + textsToFind[k] + '`')
browser.assert.equal(result.value[k].indexOf(textsToFind[k]) !== -1, true)
}
callback()
})
}

@ -519,6 +519,8 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
<div id='staticanalysisresult' >
<RemixUiCheckbox
id="showLibWarnings"
name="showLibWarnings"
categoryId="showLibWarnings"
inputType="checkbox"
checked={showLibsWarning}
label="Show library files analysis"

Loading…
Cancel
Save