Commit 2b91c6a7 authored by yann300's avatar yann300

fix tests

parent 6017b959
......@@ -21,6 +21,7 @@ function testContracts (browser, contractCode, compiledContractNames, callback)
.clearValue('#input textarea')
.click('.newFile')
.setValue('#input textarea', contractCode, function () {})
.waitForElementPresent('.contract .create', 2000)
checkCompiledContracts(browser, compiledContractNames, callback)
.waitForElementPresent('.contract .create', 2000, true, function () {
checkCompiledContracts(browser, compiledContractNames, callback)
})
}
'use strict'
module.exports = {
listSelectorContains: listSelectorContains
}
function listSelectorContains (textsToFind, selector, browser, callback) {
browser
.elements('css selector', selector, function (warnings) {
warnings.value.map(function (warning, index) {
browser.elementIdText(warning.ELEMENT, function (text) {
browser.assert.equal(text.value.indexOf(textsToFind[index]) !== -1, true)
if (index === warnings.value.length - 1) {
callback()
}
})
})
})
}
......@@ -2,6 +2,7 @@
var contractHelper = require('../helpers/contracts')
var init = require('../helpers/init')
var sauce = require('./sauce')
var dom = require('../helpers/dom')
var sources = {
'sources': {
......@@ -28,33 +29,22 @@ module.exports = {
tearDown: sauce
}
function findText (browser, selector, textToFind) {
var found = false
browser
.elements('css selector', selector, function (warnings) {
warnings.value.forEach(function (warning) {
browser.elementIdText(warning.ELEMENT, function (text) {
if (text.indexOf(textToFind) >= 0) {
found = true
}
})
})
})
browser.assert.equal(found, true)
}
function runTests (browser) {
browser
.waitForElementVisible('.newFile', 10000)
contractHelper.testContracts(browser, sources.sources.Untitled, ['TooMuchGas', 'test1', 'test2'], function () {
console.log('pppzzz?')
browser
.click('.staticanalysisView')
.click('#staticanalysisView button')
.waitForElementPresent('#staticanalysisresult .warning')
findText(browser, '#staticanalysisresult .warning span',
'Untitled:2:33: use of tx.origin')
findText(browser, '#staticanalysisresult .warning span',
'Fallback function of contract TooMuchGas requires too much gas')
browser.end()
.waitForElementPresent('#staticanalysisresult .warning', 2000, true, function () {
dom.listSelectorContains(['Untitled:1:34: use of tx.origin',
'Fallback function of contract TooMuchGas requires too much gas'],
'#staticanalysisresult .warning span',
browser, function () {
browser.end()
}
)
})
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment