add browser test for testing external web3

pull/1/head
yann300 5 years ago
parent 6e27df8eb0
commit dae6468dd0
  1. 1
      ci/browser_tests.sh
  2. 673
      package-lock.json
  3. 4
      package.json
  4. 2
      src/app/panels/terminal.js
  5. 3
      test-browser/commands/clickInstance.js
  6. 19
      test-browser/commands/journalLastChildIncludes.js
  7. 17
      test-browser/tests/ballot.js

@ -15,6 +15,7 @@ BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
echo "$BUILD_ID"
TEST_EXITCODE=0
npm run ganache-cli &
npm run serve &
setupRemixd

673
package-lock.json generated

@ -7257,6 +7257,679 @@
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true
},
"ganache-cli": {
"version": "6.8.1",
"resolved": "https://registry.npmjs.org/ganache-cli/-/ganache-cli-6.8.1.tgz",
"integrity": "sha512-nzmIwn2Mg0zb8yUM0vfGI1uMnjHf/j4ZzCE+90sXAAbOKbaq1zxRCRo5zyMXMHrB/c6JtD2mMbO4cEz74gospA==",
"dev": true,
"requires": {
"ethereumjs-util": "6.1.0",
"source-map-support": "0.5.12",
"yargs": "13.2.4"
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"bundled": true,
"dev": true
},
"ansi-styles": {
"version": "3.2.1",
"bundled": true,
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
},
"bindings": {
"version": "1.5.0",
"bundled": true,
"dev": true,
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"bip66": {
"version": "1.1.5",
"bundled": true,
"dev": true,
"requires": {
"safe-buffer": "^5.0.1"
}
},
"bn.js": {
"version": "4.11.8",
"bundled": true,
"dev": true
},
"brorand": {
"version": "1.1.0",
"bundled": true,
"dev": true
},
"browserify-aes": {
"version": "1.2.0",
"bundled": true,
"dev": true,
"requires": {
"buffer-xor": "^1.0.3",
"cipher-base": "^1.0.0",
"create-hash": "^1.1.0",
"evp_bytestokey": "^1.0.3",
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
}
},
"buffer-from": {
"version": "1.1.1",
"bundled": true,
"dev": true
},
"buffer-xor": {
"version": "1.0.3",
"bundled": true,
"dev": true
},
"camelcase": {
"version": "5.3.1",
"bundled": true,
"dev": true
},
"cipher-base": {
"version": "1.0.4",
"bundled": true,
"dev": true,
"requires": {
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
}
},
"cliui": {
"version": "5.0.0",
"bundled": true,
"dev": true,
"requires": {
"string-width": "^3.1.0",
"strip-ansi": "^5.2.0",
"wrap-ansi": "^5.1.0"
}
},
"color-convert": {
"version": "1.9.3",
"bundled": true,
"dev": true,
"requires": {
"color-name": "1.1.3"
}
},
"color-name": {
"version": "1.1.3",
"bundled": true,
"dev": true
},
"create-hash": {
"version": "1.2.0",
"bundled": true,
"dev": true,
"requires": {
"cipher-base": "^1.0.1",
"inherits": "^2.0.1",
"md5.js": "^1.3.4",
"ripemd160": "^2.0.1",
"sha.js": "^2.4.0"
}
},
"create-hmac": {
"version": "1.1.7",
"bundled": true,
"dev": true,
"requires": {
"cipher-base": "^1.0.3",
"create-hash": "^1.1.0",
"inherits": "^2.0.1",
"ripemd160": "^2.0.0",
"safe-buffer": "^5.0.1",
"sha.js": "^2.4.8"
}
},
"cross-spawn": {
"version": "6.0.5",
"bundled": true,
"dev": true,
"requires": {
"nice-try": "^1.0.4",
"path-key": "^2.0.1",
"semver": "^5.5.0",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
}
},
"decamelize": {
"version": "1.2.0",
"bundled": true,
"dev": true
},
"drbg.js": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"requires": {
"browserify-aes": "^1.0.6",
"create-hash": "^1.1.2",
"create-hmac": "^1.1.4"
}
},
"elliptic": {
"version": "6.5.0",
"bundled": true,
"dev": true,
"requires": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
}
},
"emoji-regex": {
"version": "7.0.3",
"bundled": true,
"dev": true
},
"end-of-stream": {
"version": "1.4.1",
"bundled": true,
"dev": true,
"requires": {
"once": "^1.4.0"
}
},
"ethereumjs-util": {
"version": "6.1.0",
"bundled": true,
"dev": true,
"requires": {
"bn.js": "^4.11.0",
"create-hash": "^1.1.2",
"ethjs-util": "0.1.6",
"keccak": "^1.0.2",
"rlp": "^2.0.0",
"safe-buffer": "^5.1.1",
"secp256k1": "^3.0.1"
}
},
"ethjs-util": {
"version": "0.1.6",
"bundled": true,
"dev": true,
"requires": {
"is-hex-prefixed": "1.0.0",
"strip-hex-prefix": "1.0.0"
}
},
"evp_bytestokey": {
"version": "1.0.3",
"bundled": true,
"dev": true,
"requires": {
"md5.js": "^1.3.4",
"safe-buffer": "^5.1.1"
}
},
"execa": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"requires": {
"cross-spawn": "^6.0.0",
"get-stream": "^4.0.0",
"is-stream": "^1.1.0",
"npm-run-path": "^2.0.0",
"p-finally": "^1.0.0",
"signal-exit": "^3.0.0",
"strip-eof": "^1.0.0"
}
},
"file-uri-to-path": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"find-up": {
"version": "3.0.0",
"bundled": true,
"dev": true,
"requires": {
"locate-path": "^3.0.0"
}
},
"get-caller-file": {
"version": "2.0.5",
"bundled": true,
"dev": true
},
"get-stream": {
"version": "4.1.0",
"bundled": true,
"dev": true,
"requires": {
"pump": "^3.0.0"
}
},
"hash-base": {
"version": "3.0.4",
"bundled": true,
"dev": true,
"requires": {
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
}
},
"hash.js": {
"version": "1.1.7",
"bundled": true,
"dev": true,
"requires": {
"inherits": "^2.0.3",
"minimalistic-assert": "^1.0.1"
}
},
"hmac-drbg": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"requires": {
"hash.js": "^1.0.3",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.1"
}
},
"inherits": {
"version": "2.0.4",
"bundled": true,
"dev": true
},
"invert-kv": {
"version": "2.0.0",
"bundled": true,
"dev": true
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"bundled": true,
"dev": true
},
"is-hex-prefixed": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"is-stream": {
"version": "1.1.0",
"bundled": true,
"dev": true
},
"isexe": {
"version": "2.0.0",
"bundled": true,
"dev": true
},
"keccak": {
"version": "1.4.0",
"bundled": true,
"dev": true,
"requires": {
"bindings": "^1.2.1",
"inherits": "^2.0.3",
"nan": "^2.2.1",
"safe-buffer": "^5.1.0"
}
},
"lcid": {
"version": "2.0.0",
"bundled": true,
"dev": true,
"requires": {
"invert-kv": "^2.0.0"
}
},
"locate-path": {
"version": "3.0.0",
"bundled": true,
"dev": true,
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"map-age-cleaner": {
"version": "0.1.3",
"bundled": true,
"dev": true,
"requires": {
"p-defer": "^1.0.0"
}
},
"md5.js": {
"version": "1.3.5",
"bundled": true,
"dev": true,
"requires": {
"hash-base": "^3.0.0",
"inherits": "^2.0.1",
"safe-buffer": "^5.1.2"
}
},
"mem": {
"version": "4.3.0",
"bundled": true,
"dev": true,
"requires": {
"map-age-cleaner": "^0.1.1",
"mimic-fn": "^2.0.0",
"p-is-promise": "^2.0.0"
}
},
"mimic-fn": {
"version": "2.1.0",
"bundled": true,
"dev": true
},
"minimalistic-assert": {
"version": "1.0.1",
"bundled": true,
"dev": true
},
"minimalistic-crypto-utils": {
"version": "1.0.1",
"bundled": true,
"dev": true
},
"nan": {
"version": "2.14.0",
"bundled": true,
"dev": true
},
"nice-try": {
"version": "1.0.5",
"bundled": true,
"dev": true
},
"npm-run-path": {
"version": "2.0.2",
"bundled": true,
"dev": true,
"requires": {
"path-key": "^2.0.0"
}
},
"once": {
"version": "1.4.0",
"bundled": true,
"dev": true,
"requires": {
"wrappy": "1"
}
},
"os-locale": {
"version": "3.1.0",
"bundled": true,
"dev": true,
"requires": {
"execa": "^1.0.0",
"lcid": "^2.0.0",
"mem": "^4.0.0"
}
},
"p-defer": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"p-finally": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"p-is-promise": {
"version": "2.1.0",
"bundled": true,
"dev": true
},
"p-limit": {
"version": "2.2.0",
"bundled": true,
"dev": true,
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"bundled": true,
"dev": true,
"requires": {
"p-limit": "^2.0.0"
}
},
"p-try": {
"version": "2.2.0",
"bundled": true,
"dev": true
},
"path-exists": {
"version": "3.0.0",
"bundled": true,
"dev": true
},
"path-key": {
"version": "2.0.1",
"bundled": true,
"dev": true
},
"pump": {
"version": "3.0.0",
"bundled": true,
"dev": true,
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
}
},
"require-directory": {
"version": "2.1.1",
"bundled": true,
"dev": true
},
"require-main-filename": {
"version": "2.0.0",
"bundled": true,
"dev": true
},
"ripemd160": {
"version": "2.0.2",
"bundled": true,
"dev": true,
"requires": {
"hash-base": "^3.0.0",
"inherits": "^2.0.1"
}
},
"rlp": {
"version": "2.2.3",
"bundled": true,
"dev": true,
"requires": {
"bn.js": "^4.11.1",
"safe-buffer": "^5.1.1"
}
},
"safe-buffer": {
"version": "5.2.0",
"bundled": true,
"dev": true
},
"secp256k1": {
"version": "3.7.1",
"bundled": true,
"dev": true,
"requires": {
"bindings": "^1.5.0",
"bip66": "^1.1.5",
"bn.js": "^4.11.8",
"create-hash": "^1.2.0",
"drbg.js": "^1.0.1",
"elliptic": "^6.4.1",
"nan": "^2.14.0",
"safe-buffer": "^5.1.2"
}
},
"semver": {
"version": "5.7.0",
"bundled": true,
"dev": true
},
"set-blocking": {
"version": "2.0.0",
"bundled": true,
"dev": true
},
"sha.js": {
"version": "2.4.11",
"bundled": true,
"dev": true,
"requires": {
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
}
},
"shebang-command": {
"version": "1.2.0",
"bundled": true,
"dev": true,
"requires": {
"shebang-regex": "^1.0.0"
}
},
"shebang-regex": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"signal-exit": {
"version": "3.0.2",
"bundled": true,
"dev": true
},
"source-map": {
"version": "0.6.1",
"bundled": true,
"dev": true
},
"source-map-support": {
"version": "0.5.12",
"bundled": true,
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"string-width": {
"version": "3.1.0",
"bundled": true,
"dev": true,
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"bundled": true,
"dev": true,
"requires": {
"ansi-regex": "^4.1.0"
}
},
"strip-eof": {
"version": "1.0.0",
"bundled": true,
"dev": true
},
"strip-hex-prefix": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"requires": {
"is-hex-prefixed": "1.0.0"
}
},
"which": {
"version": "1.3.1",
"bundled": true,
"dev": true,
"requires": {
"isexe": "^2.0.0"
}
},
"which-module": {
"version": "2.0.0",
"bundled": true,
"dev": true
},
"wrap-ansi": {
"version": "5.1.0",
"bundled": true,
"dev": true,
"requires": {
"ansi-styles": "^3.2.0",
"string-width": "^3.0.0",
"strip-ansi": "^5.0.0"
}
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
},
"y18n": {
"version": "4.0.0",
"bundled": true,
"dev": true
},
"yargs": {
"version": "13.2.4",
"bundled": true,
"dev": true,
"requires": {
"cliui": "^5.0.0",
"find-up": "^3.0.0",
"get-caller-file": "^2.0.1",
"os-locale": "^3.1.0",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^3.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^13.1.0"
}
},
"yargs-parser": {
"version": "13.1.1",
"bundled": true,
"dev": true,
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
},
"gauge": {
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",

@ -37,6 +37,7 @@
"exorcist": "^0.4.0",
"fast-async": "^7.0.6",
"fast-levenshtein": "^2.0.6",
"ganache-cli": "^6.8.1",
"gists": "^1.0.1",
"ipfs-mini": "^1.1.5",
"is-electron": "^2.2.0",
@ -182,6 +183,7 @@
"test": "csslint && standard && node test/index.js",
"test-browser": "npm-run-all -lpr selenium downloadsolc_root make-mock-compiler serve browsertest",
"watch": "watchify src/index.js -dv -p browserify-reload -o build/app.js --exclude solc",
"reinstall": "rm ./node-modules/ -rf; rm package-lock.json; rm ./build/ -rf; npm install; npm run build"
"reinstall": "rm ./node-modules/ -rf; rm package-lock.json; rm ./build/ -rf; npm install; npm run build",
"ganache-cli": "npx ganache-cli"
}
}

@ -148,7 +148,7 @@ class Terminal extends Plugin {
${self._view.dragbar}
<div class="${css.menu} border-top border-dark bg-light">
${self._view.icon}
<div class=${css.clear} onclick=${clear}>
<div class=${css.clear} id="clearConsole" onclick=${clear}>
<i class="fas fa-ban" aria-hidden="true" title="Clear console"
onmouseenter=${hover} onmouseleave=${hover}></i>
</div>

@ -3,7 +3,8 @@ const EventEmitter = require('events')
class ClickInstance extends EventEmitter {
command (index) {
index = index + 2
this.api.click('.instance:nth-of-type(' + index + ') > div > button').perform(() => { this.emit('complete') })
let selector = '.instance:nth-of-type(' + index + ') > div > button'
this.api.waitForElementPresent(selector).click(selector).perform(() => { this.emit('complete') })
return this
}
}

@ -0,0 +1,19 @@
const EventEmitter = require('events')
/*
Check if the last log in the console contains a specific text
*/
class JournalLastChildIncludes extends EventEmitter {
command (val) {
this.api
.waitForElementVisible('#journal > div:last-child', 10000)
.getText('#journal > div:last-child', (result) => {
console.log('JournalLastChildIncludes', result.value)
if (result.value.indexOf(val) === -1) return this.api.assert.fail(`wait for ${val} in ${result.value}`)
this.emit('complete')
})
return this
}
}
module.exports = JournalLastChildIncludes

@ -55,8 +55,25 @@ module.exports = {
.testFunction('delegate - transact (not payable)', '0xca58080c8099429caeeffe43b8104df919c2c543dceb9edf9242fa55f045c803',
`[vm]\nfrom:0xca3...a733c\nto:Ballot.delegate(address) 0x692...77b3a\nvalue:0 wei\ndata:0x5c1...4d2db\nlogs:0\nhash:0xca5...5c803`,
{types: 'address to', values: '"0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db"'}, null, null)
},
'Deploy and use Ballot using external web3': function (browser) {
browser
.click('#selectExEnvOptions #web3-mode')
.modalFooterOKClick()
.clickLaunchIcon('solidity')
.testContracts('Untitled.sol', sources[0]['browser/Untitled.sol'], ['Ballot'])
.clickLaunchIcon('udapp')
.setValue('input[placeholder="bytes32[] proposalNames"]', '["0x48656c6c6f20576f726c64210000000000000000000000000000000000000000"]')
.click('#runTabView button[class^="instanceButton"]')
.clickInstance(0)
.click('#clearConsole')
.clickFunction('delegate - transact (not payable)', {types: 'address to', values: '0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c'})
.journalLastChildIncludes('Ballot.delegate(address)')
.journalLastChildIncludes('data:0x5c1...a733c')
.end()
},
tearDown: sauce
}

Loading…
Cancel
Save