remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/test-browser/tests/staticanalysis.js

56 lines
1.5 KiB

8 years ago
'use strict'
var contractHelper = require('../helpers/contracts')
var init = require('../helpers/init')
var sauce = require('./sauce')
8 years ago
var dom = require('../helpers/dom')
8 years ago
var sources = [
{
7 years ago
'browser/Untitled.sol': {content: `
contract test1 { address test = tx.origin; }
contract test2 {}
contract TooMuchGas {
uint x;
6 years ago
function() external {
x++;
uint test;
uint test1;
}
7 years ago
}`}}
]
8 years ago
module.exports = {
before: function (browser, done) {
init(browser, done)
},
'@sources': function () {
return sources
},
'Static Analysis': function (browser) {
runTests(browser)
},
tearDown: sauce
}
function runTests (browser) {
7 years ago
browser.setEditorValue = contractHelper.setEditorValue
8 years ago
browser
.waitForElementVisible('.newFile', 10000)
7 years ago
.click('.compileView')
7 years ago
contractHelper.testContracts(browser, 'Untitled.sol', sources[0]['browser/Untitled.sol'], ['TooMuchGas', 'test1', 'test2'], function () {
8 years ago
browser
.click('.staticanalysisView')
.click('#staticanalysisView button')
.waitForElementPresent('#staticanalysisresult .staticAnalysisWarning', 2000, true, function () {
7 years ago
dom.listSelectorContains(['browser/Untitled.sol:2:33:Use of tx.origin',
'Fallback function of contract TooMuchGas requires too much gas',
'TooMuchGas.() : Variables have very similar names test and test1.'],
'#staticanalysisresult .staticAnalysisWarning',
8 years ago
browser, function () {
browser.end()
}
)
})
8 years ago
})
}