better testing

pull/1/head
yann300 7 years ago
parent 3313d4cb45
commit fc87439913
  1. 18
      test-browser/helpers/contracts.js

@ -85,23 +85,17 @@ function clickFunction (fnFullName, expectedInput) {
} }
function verifyCallReturnValue (browser, address, checks, done) { function verifyCallReturnValue (browser, address, checks, done) {
browser.execute(function (address, checks) { browser.execute(function (address) {
var nodes = document.querySelectorAll('#instance' + address + ' div[class^="contractProperty"] div[class^="value"]') var nodes = document.querySelectorAll('#instance' + address + ' div[class^="contractProperty"] div[class^="value"]')
var ret = {sucess: true} var ret = []
for (var k in checks) { for (var k in checks) {
var text = nodes[k].innerText ? nodes[k].innerText : nodes[k].textContent var text = nodes[k].innerText ? nodes[k].innerText : nodes[k].textContent
text = text.replace('\n', '') ret.push(text)
if (checks[k] !== text) {
ret.sucess = false
ret.expected = checks[k]
ret.got = text
return ret
}
} }
return ret return ret
}, [address, checks], function (result) { }, [address], function (result) {
if (!result.value.sucess) { for (var k in checks) {
browser.assert.fail('verifyCallReturnValue failed', JSON.stringify(result.value), '') browser.assert.equal(checks[k], result.value[k])
} }
done() done()
}) })

Loading…
Cancel
Save