diff --git a/.circleci/config.yml b/.circleci/config.yml index 31f462321a..44327e2e74 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -611,6 +611,7 @@ jobs: - run: yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules || yarn install --cwd ./apps/remix-ide-e2e --modules-folder ../../node_modules - run: mkdir node_modules/hardhat && wget https://unpkg.com/hardhat/console.sol -O node_modules/hardhat/console.sol - run: ls -la ./dist/apps/remix-ide/assets/js + - run: sudo apt update && sudo apt install python3-pip -y - when: condition: equal: [ "chrome", << parameters.browser >> ] diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index 604277ae6b..c26d9b22fa 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts @@ -243,7 +243,42 @@ module.exports = { done() }) }) - } + }, + + 'Should install slither #group6': function (browser: NightwatchBrowser) { + browser.perform(async (done) => { + await installSlither() + done() + }) + }, + 'Should perform slither analysis #group6': function (browser: NightwatchBrowser) { + + browser.perform(async (done) => { + try { + remixd = await spawnRemixd(join(process.cwd(), '/apps/remix-ide', '/contracts')) + } catch (err) { + console.error(err) + } + console.log('working directory', process.cwd()) + connectRemixd(browser, done) + }) + .openFile('ballot.sol') + .pause(2000) + .clickLaunchIcon('solidityStaticAnalysis') + .useXpath() + .click('//*[@id="staticAnalysisRunBtn"]') + .waitForElementPresent('//*[@id="staticanalysisresult"]', 5000) + .waitForElementVisible({ + selector: "//*[@data-id='nolibslitherwarnings'][contains(text(), '3')]", + locateStrategy: 'xpath', + timeout: 5000 + }) + .waitForElementVisible({ + selector: "//div[@data-id='block']/span[contains(text(), '3 warnings found.')]", + locateStrategy: 'xpath', + timeout: 5000 + }) + } } function runTests(browser: NightwatchBrowser, done: any) { @@ -477,3 +512,27 @@ async function buildFoundryProject(): Promise { console.log(e) } } + +async function installSlither(): Promise { + console.log('installSlither', process.cwd()) + try { + const server = spawn('node', ['./dist/libs/remixd/src/scripts/installSlither.js'], { cwd: process.cwd(), shell: true, detached: true }) + return new Promise((resolve, reject) => { + server.stdout.on('data', function (data) { + console.log(data.toString()) + if ( + data.toString().includes("Slither is ready to use") + ) { + console.log('resolving') + resolve() + } + }) + server.stderr.on('err', function (data) { + console.log(data.toString()) + reject(data.toString()) + }) + }) + } catch (e) { + console.log(e) + } +} diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx index 5840411c30..7b3241481d 100644 --- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx +++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx @@ -721,11 +721,11 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { Slither {slitherWarnings.length > 0 ? ( hideWarnings ? ( - {slitherErrors.length} + {slitherErrors.length} ) : showLibsWarning && !hideWarnings ? ( - 0 ? `badge-danger` : 'badge-warning'} badge-pill mx-1 ml-1 text-center`}>{slitherWarnings.length} + 0 ? `badge-danger` : 'badge-warning'} badge-pill mx-1 ml-1 text-center`}>{slitherWarnings.length} ) : ( - 0 ? `badge-danger` : 'badge-warning'} badge-pill mx-1 ml-1 text-center`}>{noLibSlitherWarnings.length} + 0 ? `badge-danger` : 'badge-warning'} badge-pill mx-1 ml-1 text-center`}>{noLibSlitherWarnings.length} ) ) : null}