From a53e89a14607c2f2cc1002502dd4f532fc1976a8 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 5 Apr 2019 16:37:21 +0200 Subject: [PATCH 1/5] fix browser test --- test-browser/helpers/contracts.js | 21 ++++++++++++++++++++- test-browser/tests/simpleContract.js | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/test-browser/helpers/contracts.js b/test-browser/helpers/contracts.js index 08a553072a..d846dcfa6f 100644 --- a/test-browser/helpers/contracts.js +++ b/test-browser/helpers/contracts.js @@ -24,7 +24,8 @@ module.exports = { renameFile, removeFile, getAddressAtPosition, - clickLaunchIcon + clickLaunchIcon, + scrollDown } function clickLaunchIcon (icon) { @@ -153,11 +154,29 @@ function testConstantFunction (browser, address, fnFullName, expectedInput, expe .click('.instance button[title="' + fnFullName + '"]') .pause(1000) .waitForElementPresent('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]') + .scrollDown('#runTabView') .assert.containsText('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]', expectedOutput).perform(() => { cb() }) } +function scrollDown (target) { + return this.perform((client, done) => { + _scrollDown(this, target, () => { + done() + }) + }) +} + +function _scrollDown (browser, target, cb) { + browser.execute(function () { + document.querySelector(target).scrollTop = 0 + document.querySelector(target).scrollTop = document.querySelector(target).scrollHeight + }, [], function () { + cb() + }) +} + function testFunction (fnFullName, txHash, log, expectedInput, expectedReturn, expectedEvent, callback) { // this => browser this.waitForElementPresent('.instance button[title="' + fnFullName + '"]') diff --git a/test-browser/tests/simpleContract.js b/test-browser/tests/simpleContract.js index eeffaffcdc..d6417cabdd 100644 --- a/test-browser/tests/simpleContract.js +++ b/test-browser/tests/simpleContract.js @@ -21,6 +21,7 @@ function runTests (browser) { browser.setEditorValue = contractHelper.setEditorValue browser.getEditorValue = contractHelper.getEditorValue browser.clickLaunchIcon = contractHelper.clickLaunchIcon + browser.scrollDown = contractHelper.scrollDown browser .waitForElementVisible('#icon-panel', 10000) .clickLaunchIcon('solidity') From 00c4555ec7000d61016a6e98526098d06ca4b901 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 8 Apr 2019 10:50:11 +0200 Subject: [PATCH 2/5] fix config --- src/universal-dapp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/universal-dapp.js b/src/universal-dapp.js index 084f8df4b7..a36e1f87ff 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -54,7 +54,7 @@ module.exports = class UniversalDApp extends ApiFactory { // TODO: most params here can be refactored away in txRunner this.txRunner = new TxRunner(this.accounts, { // TODO: only used to check value of doNotShowTransactionConfirmationAgain property - config: this.config, + config: this._deps.config, // TODO: to refactor, TxRunner already has access to executionContext detectNetwork: (cb) => { executionContext.detectNetwork(cb) From 7f5d175f176f82706206446fb2ebda3fe788d11c Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 8 Apr 2019 10:50:20 +0200 Subject: [PATCH 3/5] fix alert msg --- src/app/execution/confirmDialog.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/execution/confirmDialog.js b/src/app/execution/confirmDialog.js index 5c9c54b5a2..2dc343365a 100644 --- a/src/app/execution/confirmDialog.js +++ b/src/app/execution/confirmDialog.js @@ -1,5 +1,6 @@ var yo = require('yo-yo') var csjs = require('csjs-inject') +const copyToClipboard = require('../ui/copy-to-clipboard') var css = csjs` .txInfoBox { @@ -35,7 +36,7 @@ function confirmDialog (tx, amount, gasEstimation, self, newGasPriceCb, initialP
Gas price: Gwei (visit ethgasstation.info to get more info about gas price)
Max transaction fee:
Data:
-
${tx.data}
+
${tx.data && tx.data.length > 50 ? tx.data.substring(0, 49) + '...' : tx.data} ${copyToClipboard(() => { return tx.data })}
From 6bb2336d41f14192e361137fe05637933e0ec3d5 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 8 Apr 2019 10:50:29 +0200 Subject: [PATCH 4/5] bug fix --- src/app/tabs/runTab/contractDropdown.js | 4 ++-- src/app/tabs/runTab/model/dropdownlogic.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/tabs/runTab/contractDropdown.js b/src/app/tabs/runTab/contractDropdown.js index 127a35dd27..f1fe65a73d 100644 --- a/src/app/tabs/runTab/contractDropdown.js +++ b/src/app/tabs/runTab/contractDropdown.js @@ -165,7 +165,7 @@ class ContractDropdownUI { { label: 'Force Send', fn: () => { - this.dropdownLogic.forceSend(selectedContract, args, continueCb, promptCb, modalDialogCustom, confirmDialog, statusCb, finalCb) + this.dropdownLogic.forceSend(selectedContract, args, continueCb, promptCb, modalDialog, confirmDialog, statusCb, finalCb) }}, { label: 'Cancel', fn: () => { @@ -173,7 +173,7 @@ class ContractDropdownUI { } }) } - this.dropdownLogic.forceSend(selectedContract, args, continueCb, promptCb, modalDialogCustom, confirmDialog, statusCb, finalCb) + this.dropdownLogic.forceSend(selectedContract, args, continueCb, promptCb, modalDialog, confirmDialog, statusCb, finalCb) } loadFromAddress () { diff --git a/src/app/tabs/runTab/model/dropdownlogic.js b/src/app/tabs/runTab/model/dropdownlogic.js index e8528630ba..b25184b0c3 100644 --- a/src/app/tabs/runTab/model/dropdownlogic.js +++ b/src/app/tabs/runTab/model/dropdownlogic.js @@ -121,7 +121,7 @@ class DropdownLogic { } // TODO: check if selectedContract and data can be joined - createContract (selectedContract, data, continueCb, promptCb, confirmDialog, modalDialog, finalCb) { + createContract (selectedContract, data, continueCb, promptCb, modalDialog, confirmDialog, finalCb) { if (data) { data.contractName = selectedContract.name data.linkReferences = selectedContract.bytecodeLinkReferences From 14a2219dc6a8b3c2daf71c4843dd3c1dec4ce0ce Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 8 Apr 2019 11:24:15 +0200 Subject: [PATCH 5/5] fix tests --- test-browser/helpers/contracts.js | 17 ++++++++--------- test-browser/tests/simpleContract.js | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/test-browser/helpers/contracts.js b/test-browser/helpers/contracts.js index d846dcfa6f..f3c90b1f73 100644 --- a/test-browser/helpers/contracts.js +++ b/test-browser/helpers/contracts.js @@ -25,7 +25,7 @@ module.exports = { removeFile, getAddressAtPosition, clickLaunchIcon, - scrollDown + scrollInto } function clickLaunchIcon (icon) { @@ -154,25 +154,24 @@ function testConstantFunction (browser, address, fnFullName, expectedInput, expe .click('.instance button[title="' + fnFullName + '"]') .pause(1000) .waitForElementPresent('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]') - .scrollDown('#runTabView') + .scrollInto('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]') .assert.containsText('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]', expectedOutput).perform(() => { cb() }) } -function scrollDown (target) { +function scrollInto (target) { return this.perform((client, done) => { - _scrollDown(this, target, () => { + _scrollInto(this, target, () => { done() }) }) } -function _scrollDown (browser, target, cb) { - browser.execute(function () { - document.querySelector(target).scrollTop = 0 - document.querySelector(target).scrollTop = document.querySelector(target).scrollHeight - }, [], function () { +function _scrollInto (browser, target, cb) { + browser.execute(function (target) { + document.querySelector(target).scrollIntoView() + }, [target], function () { cb() }) } diff --git a/test-browser/tests/simpleContract.js b/test-browser/tests/simpleContract.js index d6417cabdd..e525e3cf32 100644 --- a/test-browser/tests/simpleContract.js +++ b/test-browser/tests/simpleContract.js @@ -21,7 +21,7 @@ function runTests (browser) { browser.setEditorValue = contractHelper.setEditorValue browser.getEditorValue = contractHelper.getEditorValue browser.clickLaunchIcon = contractHelper.clickLaunchIcon - browser.scrollDown = contractHelper.scrollDown + browser.scrollInto = contractHelper.scrollInto browser .waitForElementVisible('#icon-panel', 10000) .clickLaunchIcon('solidity')