From 4e1ef759fe41f76a43f5c42242bfb4451079a46c Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 20 Jun 2019 17:09:02 +0200 Subject: [PATCH] refactor browser tests --- test-browser/tests/compiling.js | 47 ++++++++++-------------- test-browser/tests/units/testRecorder.js | 2 +- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/test-browser/tests/compiling.js b/test-browser/tests/compiling.js index eb960bd592..8c21f7157c 100644 --- a/test-browser/tests/compiling.js +++ b/test-browser/tests/compiling.js @@ -11,26 +11,9 @@ module.exports = { '@sources': function () { 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) { - browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract']) + 'Test Simple Contract': function (browser) { + browser.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['TestContract']) .clickLaunchIcon('run') .click('#runTabView button[class^="instanceButton"]') .waitForElementPresent('.instance:nth-of-type(2)') @@ -54,11 +37,10 @@ function testSimpleContract (browser, callback) { "3": "uint256: 4" }`) .click('i[class^="clearinstance"]') - .perform(() => { callback(null, browser) }) -} + }, -function testReturnValues (browser, callback) { - browser.testContracts('returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues']) + 'Test Return Values': function (browser) { + browser.testContracts('returnValues.sol', sources[1]['browser/returnValues.sol'], ['testReturnValues']) .clickLaunchIcon('run') .click('#runTabView button[class^="instanceButton"]') .waitForElementPresent('.instance:nth-of-type(2)') @@ -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, `{ "0": "uint8: _en 2", "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) { - browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test']) + 'Test Input Values': function (browser) { + browser.testContracts('inputValues.sol', sources[2]['browser/inputValues.sol'], ['test']) .clickLaunchIcon('run') .click('#runTabView button[class^="instanceButton"]') .waitForElementPresent('.instance:nth-of-type(2)') @@ -144,7 +126,16 @@ function testInputValues (browser, callback) { } ]`) .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 diff --git a/test-browser/tests/units/testRecorder.js b/test-browser/tests/units/testRecorder.js index 10df90bce7..8a2996800c 100644 --- a/test-browser/tests/units/testRecorder.js +++ b/test-browser/tests/units/testRecorder.js @@ -1,7 +1,7 @@ 'use strict' module.exports = { - '@disabled': true, // run by compiling.j + '@disabled': true, // run by compiling. '@sources': function () { return sources },