replace css selector with xpath in e2e

pull/3876/head
Joseph Izang 1 year ago
parent a0c9bd83a3
commit 76778ccede
  1. 60
      apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts

@ -33,36 +33,36 @@ module.exports = {
}, },
'run analysis and filter results': function (browser: NightwatchBrowser) { 'run analysis and filter results': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.click('*[data-id="treeViewLitreeViewItemcontracts"]') .click('*[data-id="treeViewLitreeViewItemcontracts"]')
.click('*[data-id="treeViewLitreeViewItemcontracts/2_Owner.sol"]') .click('*[data-id="treeViewLitreeViewItemcontracts/2_Owner.sol"]')
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.click('*[id="compileBtn"]') .click('*[id="compileBtn"]')
.pause(10000) .pause(10000)
.clickLaunchIcon('solidityStaticAnalysis') .clickLaunchIcon('solidityStaticAnalysis')
.click('div#staticAnalysisWrapper > *[id="staticAnalysisRunBtn"]') .useXpath()
.useXpath() .click('//*[@id="staticAnalysisRunBtn"]')
// .waitForElementPresent('div#staticanalysisresult .warning', 5000) // .waitForElementPresent('div#staticanalysisresult .warning', 5000)
.waitForElementPresent('//*[@id="staticanalysisresult"]', 5000) .waitForElementPresent('//*[@id="staticanalysisresult"]', 5000)
.useCss() .useCss()
// Check warning count // Check warning count
.click('*[data-rb-event-key="remix"]') .click('*[data-rb-event-key="remix"]')
.assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount"]', '1') .assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount"]', '1')
.verify.elementPresent('input[name="showLibWarnings"]') .verify.elementPresent('input[name="showLibWarnings"]')
.verify.not.elementPresent('input[name="showLibWarnings"]:checked') .verify.not.elementPresent('input[name="showLibWarnings"]:checked')
.verify.elementPresent('label[id="headingshowLibWarnings"]') .verify.elementPresent('label[id="headingshowLibWarnings"]')
.click('label[id="headingshowLibWarnings"]') .click('label[id="headingshowLibWarnings"]')
.pause(1000) .pause(1000)
.click('*[data-rb-event-key="remix"]') .click('*[data-rb-event-key="remix"]')
.assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount', '382') .assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount', '382')
.click('label[id="headingshowLibWarnings"]') .click('label[id="headingshowLibWarnings"]')
.pause(1000) .pause(1000)
.assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount', '1') .assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount', '1')
.end() .end()
} }
} }
function runTests (browser: NightwatchBrowser) { function runTests(browser: NightwatchBrowser) {
browser browser
.waitForElementVisible('#icon-panel', 10000) .waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
@ -75,13 +75,13 @@ function runTests (browser: NightwatchBrowser) {
'Fallback function of contract TooMuchGas requires too much gas', 'Fallback function of contract TooMuchGas requires too much gas',
'TooMuchGas.() : Variables have very similar names "test" and "test1".', 'TooMuchGas.() : Variables have very similar names "test" and "test1".',
'TooMuchGas.() : Variables have very similar names "test" and "test1".'], 'TooMuchGas.() : Variables have very similar names "test" and "test1".'],
'#staticanalysisresult .warning', '#staticanalysisresult .warning',
browser browser
) )
}) })
} }
function listSelectorContains (textsToFind: string[], selector: string, browser: NightwatchBrowser) { function listSelectorContains(textsToFind: string[], selector: string, browser: NightwatchBrowser) {
browser.execute(function (selector) { browser.execute(function (selector) {
const items = document.querySelectorAll(selector) const items = document.querySelectorAll(selector)
const ret = [] const ret = []

Loading…
Cancel
Save