Merge pull request #1816 from ethereum/fixBrowserTest

Fix browser test
pull/3094/head
yann300 6 years ago committed by GitHub
commit 4ad8d2cfa5
  1. 3
      src/app/execution/confirmDialog.js
  2. 4
      src/app/tabs/runTab/contractDropdown.js
  3. 2
      src/app/tabs/runTab/model/dropdownlogic.js
  4. 2
      src/universal-dapp.js
  5. 20
      test-browser/helpers/contracts.js
  6. 1
      test-browser/tests/simpleContract.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
<div>Gas price: <input id='gasprice' oninput=${onGasPriceChange} /> Gwei <span> (visit <a target='_blank' href='https://ethgasstation.info'>ethgasstation.info</a> to get more info about gas price)</span></div>
<div>Max transaction fee:<span id='txfee'></span></div>
<div>Data:</div>
<pre class=${css.wrapword}>${tx.data}</pre>
<pre class=${css.wrapword}>${tx.data && tx.data.length > 50 ? tx.data.substring(0, 49) + '...' : tx.data} ${copyToClipboard(() => { return tx.data })}</pre>
</div>
<div class=${css.checkbox}>
<input id='confirmsetting' type="checkbox">

@ -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 () {

@ -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

@ -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)

@ -24,7 +24,8 @@ module.exports = {
renameFile,
removeFile,
getAddressAtPosition,
clickLaunchIcon
clickLaunchIcon,
scrollInto
}
function clickLaunchIcon (icon) {
@ -153,11 +154,28 @@ function testConstantFunction (browser, address, fnFullName, expectedInput, expe
.click('.instance button[title="' + fnFullName + '"]')
.pause(1000)
.waitForElementPresent('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]')
.scrollInto('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]')
.assert.containsText('#instance' + address + ' div[class^="contractActionsContainer"] div[class^="value"]', expectedOutput).perform(() => {
cb()
})
}
function scrollInto (target) {
return this.perform((client, done) => {
_scrollInto(this, target, () => {
done()
})
})
}
function _scrollInto (browser, target, cb) {
browser.execute(function (target) {
document.querySelector(target).scrollIntoView()
}, [target], function () {
cb()
})
}
function testFunction (fnFullName, txHash, log, expectedInput, expectedReturn, expectedEvent, callback) {
// this => browser
this.waitForElementPresent('.instance button[title="' + fnFullName + '"]')

@ -21,6 +21,7 @@ function runTests (browser) {
browser.setEditorValue = contractHelper.setEditorValue
browser.getEditorValue = contractHelper.getEditorValue
browser.clickLaunchIcon = contractHelper.clickLaunchIcon
browser.scrollInto = contractHelper.scrollInto
browser
.waitForElementVisible('#icon-panel', 10000)
.clickLaunchIcon('solidity')

Loading…
Cancel
Save