Commit a3fcd865 authored by yann300's avatar yann300

refactor browser tests

parent e96bd6b5
...@@ -11,26 +11,9 @@ module.exports = { ...@@ -11,26 +11,9 @@ module.exports = {
'@sources': function () { '@sources': function () {
return sources return sources
}, },
'Compiling': function (browser) {
runTests(browser)
},
tearDown: sauce
}
function runTests (browser) {
browser
.waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('solidity')
.perform(() => {
// the first fn is used to pass browser to the other ones.
async.waterfall([function (callback) { callback(null, browser) }, testSimpleContract, testReturnValues, testInputValues, testRecorder.test], function () {
browser.end()
})
})
}
function testSimpleContract (browser, callback) { 'Test Simple Contract': function (browser) {
browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract']) browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract'])
.clickLaunchIcon('run') .clickLaunchIcon('run')
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
...@@ -54,11 +37,10 @@ function testSimpleContract (browser, callback) { ...@@ -54,11 +37,10 @@ function testSimpleContract (browser, callback) {
"3": "uint256: 4" "3": "uint256: 4"
}`) }`)
.click('i[class^="clearinstance"]') .click('i[class^="clearinstance"]')
.perform(() => { callback(null, browser) }) },
}
function testReturnValues (browser, callback) { 'Test Return Values': function (browser) {
browser.testContracts('returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues']) browser.testContracts('returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues'])
.clickLaunchIcon('run') .clickLaunchIcon('run')
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
...@@ -91,11 +73,11 @@ function testReturnValues (browser, callback) { ...@@ -91,11 +73,11 @@ function testReturnValues (browser, callback) {
'[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues3() 0x5e7...26e9f\nvalue:0 wei\ndata:0x033...e0a7d\nlogs:0\nhash:0x94c...9d28a', null, `{ '[vm]\nfrom:0xca3...a733c\nto:testReturnValues.retunValues3() 0x5e7...26e9f\nvalue:0 wei\ndata:0x033...e0a7d\nlogs:0\nhash:0x94c...9d28a', null, `{
"0": "uint8: _en 2", "0": "uint8: _en 2",
"1": "int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7" "1": "int256[5][]: _a1 1,-45,-78,56,60,-1,42,334,-45455,-446,1,10,-5435,45,-7"
}`).click('i[class^="clearinstance"]').perform(() => { callback(null, browser) }) }`).click('i[class^="clearinstance"]')
} },
function testInputValues (browser, callback) { 'Test Input Values': function (browser) {
browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test']) browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test'])
.clickLaunchIcon('run') .clickLaunchIcon('run')
.click('#runTabView button[class^="instanceButton"]') .click('#runTabView button[class^="instanceButton"]')
.waitForElementPresent('.instance:nth-of-type(2)') .waitForElementPresent('.instance:nth-of-type(2)')
...@@ -144,7 +126,16 @@ function testInputValues (browser, callback) { ...@@ -144,7 +126,16 @@ function testInputValues (browser, callback) {
} }
]`) ]`)
.click('i[class^="clearinstance"]') .click('i[class^="clearinstance"]')
.perform(() => { callback(null, browser) }) .end()
},
'Test Recorder': function (browser) {
testRecorder.test(browser, () => {
browser.end()
})
},
tearDown: sauce
} }
// @TODO test: bytes8[3][] type as input // @TODO test: bytes8[3][] type as input
......
'use strict' 'use strict'
module.exports = { module.exports = {
'@disabled': true, // run by compiling.j '@disabled': true, // run by compiling.
'@sources': function () { '@sources': function () {
return sources return sources
}, },
......
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