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/helpers/contracts.js

41 lines
1.1 KiB

'use strict'
8 years ago
module.exports = {
checkCompiledContracts: checkCompiledContracts,
testContracts: testContracts
}
function checkCompiledContracts (browser, compiled, callback) {
7 years ago
browser.execute(function () {
var contracts = document.querySelectorAll('#compileTabView select option')
if (!contracts) {
return null
} else {
var ret = []
7 years ago
for (var c = 0; c < contracts.length; c++) {
ret.push(contracts[c].querySelector('div').innerHTML)
7 years ago
}
return ret
}
}, [], function (result) {
if (!result.value) {
browser.end('no compiled contracts')
} else {
result.value.map(function (item, i) {
browser.assert.equal(item, compiled[i])
})
7 years ago
}
callback()
})
}
function testContracts (browser, contractCode, compiledContractNames, callback) {
browser
.clearValue('#input textarea')
.click('.newFile')
.setValue('#input textarea', contractCode, function () {})
7 years ago
.waitForElementPresent('#compileTabView select option', 50000, true, function () {
8 years ago
checkCompiledContracts(browser, compiledContractNames, callback)
})
}