Commit f2718ef8 authored by yann300's avatar yann300 Committed by Alex Beregszaszi

Move to compilation test to tests directory.

parent f3cf0250
module.exports = {
'Compile Simple Contract': function (browser) {
browser
.url('http://127.0.0.1:8080')
// It compiles the default contract
.waitForElementPresent('.contract .create', 3000000)
// Change the text and wait for recompile
.clearValue('#input textarea')
.setValue('#input textarea', `
pragma solidity ^0.4.0;
contract TestContract { function f() returns (uint) { return 8; } }
`)
var waitForElementToContainText = function (element, text, done) {
browser.getText(element, function (t) {
if (t.value.indexOf(text) < 0) {
browser.pause(500)
waitForElementToContainText(element, text, done)
} else {
done()
}
})
}
browser.perform(function (done) {
waitForElementToContainText('.contract .title', 'TestContract', done)
})
browser.assert.containsText('.contract .title', 'TestContract')
.click('.create .constructor .call')
.waitForElementPresent('.instance .call[title="f"]')
.click('.instance .call[title="f"]')
.waitForElementPresent('.output .returned')
.assert.containsText('.output .returned', '0x0000000000000000000000000000000000000000000000000000000000000008')
.assert.containsText('.output .decoded li', 'uint256: 8')
.end()
}
}
'use strict'
var contractHelper = require('../helpers/contracts')
var init = require('../helpers/init')
var sauce = require('./sauce')
var sources = {
'sources': {
'Untitled': `pragma solidity ^0.4.0;
contract TestContract { function f() returns (uint) { return 8; } }`
}
}
module.exports = {
before: function (browser, done) {
init(browser, done)
},
'@sources': function () {
return sources
},
'Simple Contract': function (browser) {
runTests(browser)
},
tearDown: sauce
}
function runTests (browser) {
browser
.waitForElementVisible('.newFile', 10000)
contractHelper.testContracts(browser, sources.sources.Untitled, ['TestContract'], function () {
browser.assert.containsText('.contract .title', 'TestContract')
.click('.create .constructor .call')
.waitForElementPresent('.instance .call[title="f"]')
.click('.instance .call[title="f"]')
.waitForElementPresent('.output .returned')
.assert.containsText('.output .returned', '0x0000000000000000000000000000000000000000000000000000000000000008')
.assert.containsText('.output .decoded li', 'uint256: 8')
.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