From 74b07238ebf2c37fb67cefdbb3780319851af285 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 25 Sep 2019 11:23:27 +0200 Subject: [PATCH] add browser tests --- package.json | 1 + src/app/tabs/test-tab.js | 6 ++--- test-browser/tests/solidityUnittests.js | 34 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 test-browser/tests/solidityUnittests.js diff --git a/package.json b/package.json index 30a67ed14e..8dc3cb02c3 100644 --- a/package.json +++ b/package.json @@ -166,6 +166,7 @@ "nightwatch_local_transactionExecution": "nightwatch ./test-browser/tests/transactionExecution.js --config nightwatch.js --env chrome ", "nightwatch_local_staticAnalysis": "nightwatch ./test-browser/tests/staticAnalysis.js --config nightwatch.js --env chrome ", "nightwatch_local_signingMessage": "nightwatch ./test-browser/tests/signingMessage.js --config nightwatch.js --env chrome ", + "nightwatch_local_solidityUnittests": "nightwatch ./test-browser/tests/solidityUnittests.js --config nightwatch.js --env chrome ", "nightwatch_local_remixd": "nightwatch ./test-browser/tests/remix.js --config nightwatch.js --env chrome ", "nightwatch_local_console": "nightwatch ./test-browser/tests/console.js --config nightwatch.js --env chrome ", "onchange": "onchange build/app.js -- npm-run-all lint", diff --git a/src/app/tabs/test-tab.js b/src/app/tabs/test-tab.js index 968a09e301..7bf70f93dc 100644 --- a/src/app/tabs/test-tab.js +++ b/src/app/tabs/test-tab.js @@ -207,7 +207,7 @@ module.exports = class TestTab extends ViewPlugin { } updateRunAction (currentFile) { - let el = yo`` + let el = yo`` const isSolidityActive = this.appManager.isActive('solidity') if (!currentFile || !isSolidityActive) { el.setAttribute('disabled', 'disabled') @@ -235,8 +235,8 @@ module.exports = class TestTab extends ViewPlugin { } render () { this.onActivationInternal() - this.testsOutput = yo`` - this.testsSummary = yo`` + this.testsOutput = yo`` + this.testsSummary = yo`` this.loading = yo`Running tests...` this.loading.hidden = true var el = yo` diff --git a/test-browser/tests/solidityUnittests.js b/test-browser/tests/solidityUnittests.js new file mode 100644 index 0000000000..49bb84e4ce --- /dev/null +++ b/test-browser/tests/solidityUnittests.js @@ -0,0 +1,34 @@ +'use strict' +var init = require('../helpers/init') +var sauce = require('./sauce') + +var sources = [] + +module.exports = { + before: function (browser, done) { + init(browser, done) + }, + '@sources': function () { + return sources + }, + 'Solidity Unittests': function (browser) { + runTests(browser) + }, + tearDown: sauce +} + +function runTests (browser) { + browser + .waitForElementVisible('#icon-panel', 10000) + .click('#icon-panel div[plugin="pluginManager"]') + .scrollAndClick('#pluginManager article[id="remixPluginManagerListItem_solidityUnitTesting"] button') + .clickLaunchIcon('fileExplorers') + .switchFile('browser/ballot.sol') + .clickLaunchIcon('solidityUnitTesting') + .scrollAndClick('#runTestsTabRunAction') + .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]') + .assert.containsText('#solidityUnittestsOutput', `browser/ballot_test.sol (test3) + ✓ (Check winning proposal) + ✓ (Check winnin proposal with return value)`) + .end() +}