From b6a7d882f04ac0fc374119182a5e7ef5e404a60d Mon Sep 17 00:00:00 2001 From: tizah Date: Sat, 17 Apr 2021 18:37:33 +0100 Subject: [PATCH] restored staticAnalysis.spec.ts to it previous code structure --- .../src/tests/staticAnalysis.spec.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/apps/remix-ide-e2e/src/tests/staticAnalysis.spec.ts b/apps/remix-ide-e2e/src/tests/staticAnalysis.spec.ts index 55f7329f65..504148b266 100644 --- a/apps/remix-ide-e2e/src/tests/staticAnalysis.spec.ts +++ b/apps/remix-ide-e2e/src/tests/staticAnalysis.spec.ts @@ -40,4 +40,34 @@ function runTests (browser: NightwatchBrowser) { .pause(10000) .testContracts('Untitled.sol', sources[0]['Untitled.sol'], ['TooMuchGas', 'test1', 'test2']) .clickLaunchIcon('solidityStaticAnalysis') + .click('#staticanalysisButton button') + .waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () { + listSelectorContains(['Use of tx.origin', + '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".'], + '#staticanalysisresult .warning', + browser, function () { + browser.end() + } + ) + }) +} + +function listSelectorContains (textsToFind: string[], selector: string, browser: NightwatchBrowser, callback: VoidFunction) { + browser.execute(function (selector) { + const items = document.querySelectorAll(selector) + const ret = [] + for (let k = 0; k < items.length; k++) { + ret.push(items[k].innerText) + } + return ret + }, [selector], function (result) { + console.log(result.value) + for (const k in textsToFind) { + console.log('testing `' + result.value[k] + '` against `' + textsToFind[k] + '`') + browser.assert.equal(result.value[k].indexOf(textsToFind[k]) !== -1, true) + } + callback() + }) }