Unverified Commit fcff1566 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #2112 from ethereum/refactorBrowserTests

Remove old files & update README
parents 50d23c06 003c2f28
......@@ -87,18 +87,22 @@ Running unit tests via `npm test` requires at least node v7.0.0
## Browser Testing
To run the Selenium tests via Nightwatch serve the app through a local web server:
To run the Selenium tests via Nightwatch:
- Build Remix IDE and serve it: `npm run build && npm run serve` # starts web server at localhost:8080
- Make sure Selenium is installed `npm run selenium-install` # don't need to repeat
- Run a selenium server `npm run selenium-install`
- Run all the tests `npm run nightwatch_local_firefox` or `npm run nightwatch_local_chrome`
- Or run a specific test case:
- npm run nightwatch_local_ballot
- npm run nightwatch_local_libraryDeployment
- npm run nightwatch_local_solidityImport
- npm run nightwatch_local_recorder
- npm run nightwatch_local_transactionExecution
- npm run nightwatch_local_staticAnalysis
- npm run nightwatch_local_signingMessage
- npm run nightwatch_local_remixd # remixd needs to be run
`npm run serve` # starts web server at localhost:8080
Then you will need to either:
1. Have a Selenium server running locally on port 4444.
- Run: `npm run test-browser`
2. Or, install and run SauceConnect.
- Run: `sc -u <USERNAME> -k <ACCESS_KEY>` (see `.travis.yml` for values)
- Run: `npm run browser-test-sc`
## Usage as a Chrome Extension
......
......@@ -20,13 +20,7 @@ setupRemixd
sleep 5
npm run nightwatch_remote_chrome || TEST_EXITCODE=1
# npm run nightwatch_remote_firefox || TEST_EXITCODE=1
# npm run nightwatch_remote_safari || TEST_EXITCODE=1
# npm run nightwatch_remote_ie || TEST_EXITCODE=1
# npm run nightwatch_remote_parallel || TEST_EXITCODE=1
# node ci/sauceDisconnect.js "$SAUCECONNECT_USERNAME" "$SAUCECONNECT_ACCESSKEY" "$SAUCECONNECT_JOBIDENTIFIER"
npm run nightwatch_local_chrome || TEST_EXITCODE=1
echo "$TEST_EXITCODE"
if [ "$TEST_EXITCODE" -eq 1 ]
......
#!/usr/bin/env bash
set -e
if test $(uname -s) = "Darwin"
then
OS="osx"
FILEFORMAT="zip"
else
OS="linux"
FILEFORMAT="tar.gz"
fi
SC_VERSION="4.5.1"
SAUCECONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-$OS.$FILEFORMAT"
SAUCECONNECT_USERNAME="yanneth"
SAUCECONNECT_ACCESSKEY="1f5a4560-b02b-41aa-b52b-f033aad30870"
BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}}
SAUCECONNECT_JOBIDENTIFIER="remix_tests_${BUILD_ID}"
SAUCECONNECT_READYFILE="sc.ready"
TEST_EXITCODE=0
npm run serve_debugger &
wget $SAUCECONNECT_URL
tar -zxvf sc-"$SC_VERSION"-"$OS"."$FILEFORMAT"
./sc-"$SC_VERSION"-$OS/bin/sc -u $SAUCECONNECT_USERNAME -k $SAUCECONNECT_ACCESSKEY -i $SAUCECONNECT_JOBIDENTIFIER --readyfile $SAUCECONNECT_READYFILE &
while [ ! -f $SAUCECONNECT_READYFILE ]; do
sleep .5
done
npm run nightwatch_remote_debugger_parallel || TEST_EXITCODE=1
node ci/sauceDisconnect.js $SAUCECONNECT_USERNAME $SAUCECONNECT_ACCESSKEY $SAUCECONNECT_JOBIDENTIFIER
echo $TEST_EXITCODE
if [ $TEST_EXITCODE -eq 1 ]
then
exit 1
fi
......@@ -55,9 +55,9 @@ module.exports = {
}
},
'local': {
'firefox': {
'desiredCapabilities': {
'browserName': 'chrome',
'browserName': 'firefox',
'javascriptEnabled': true,
'acceptSslCerts': true
}
......
......@@ -152,24 +152,22 @@
"lint": "standard | notify-error",
"make-mock-compiler": "node ci/makeMockCompiler.js",
"minify": "uglifyjs --in-source-map inline --source-map-inline -c warnings=false",
"nightwatch_local": "nightwatch --config nightwatch.js --env local",
"nightwatch_local_firefox": "nightwatch --config nightwatch.js --env firefox",
"nightwatch_local_chrome": "nightwatch --config nightwatch.js --env chrome",
"nightwatch_local_ballot": "nightwatch ./test-browser/tests/ballot.js --config nightwatch.js --env local ",
"nightwatch_local_libraryDeployment": "nightwatch ./test-browser/tests/libraryDeployment.js --config nightwatch.js --env local ",
"nightwatch_local_solidityImport": "nightwatch ./test-browser/tests/solidityImport.js --config nightwatch.js --env local ",
"nightwatch_local_recorder": "nightwatch ./test-browser/tests/recorder.js --config nightwatch.js --env local ",
"nightwatch_local_transactionExecution": "nightwatch ./test-browser/tests/transactionExecution.js --config nightwatch.js --env local ",
"nightwatch_local_staticAnalysis": "nightwatch ./test-browser/tests/staticanalysis.js --config nightwatch.js --env local ",
"nightwatch_local_signingMessage": "nightwatch ./test-browser/tests/signingMessage.js --config nightwatch.js --env local ",
"nightwatch_local_sharedFolderExplorer": "nightwatch ./test-browser/tests/sharedFolderExplorer.js --config nightwatch.js --env local ",
"nightwatch_local_debugger": "nightwatch --config nightwatch_debugger.js --env local",
"nightwatch_remote_chrome": "nightwatch --config nightwatch.js --env chrome",
"nightwatch_remote_firefox": "nightwatch --config nightwatch.js --env default",
"nightwatch_remote_ie": "nightwatch --config nightwatch.js --env ie",
"nightwatch_remote_parallel": "nightwatch --config nightwatch.js --env safari,chrome,default",
"nightwatch_remote_safari": "nightwatch --config nightwatch.js --env safari",
"nightwatch_remote_debugger_parallel": "nightwatch --config nightwatch_debugger.js --env safari,chrome,default",
"nightwatch_local_remixd": "nightwatch ./test-browser/tests/remix.js --config nightwatch.js --env local ",
"onchange": "onchange build/app.js -- npm-run-all lint",
"prepublish": "mkdirp build; npm-run-all -ls downloadsolc_root build",
"remixd": "remixd -s ./contracts --remix-ide http://127.0.0.1:8080",
"selenium": "selenium-standalone start",
"selenium-install": "selenium-standalone install",
"serve": "npx http-server .",
"serve_debugger": "npx http-server src/app/debugger/remix-debugger",
"sourcemap": "exorcist --root ../ build/app.js.map > build/app.js",
"start": "npm-run-all -lpr serve watch onchange remixd",
"test": "csslint && standard && node test/index.js",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
</head>
<body onload="loadDebugger()" >
<script type="text/javascript">
function loadDebugger() {
var container = document.getElementById('app')
var debuggerBackend = new window.remix.ui.DebuggerBackend({})
container.debugger = new window.remix.ui.Debugger({debugger: debuggerBackend})
container.appendChild(container.debugger.render())
}
</script>
<div id="app"></div>
<script src="build/app.js"></script>
</body>
</html>
'use strict'
// TODO: this file doesn't seem to be used any more and can be removed
var VMDebugger = require('./src/ui/VmDebugger')
var Debugger = require('./src/ui/EthdebuggerUI')
var DebuggerBackend = require('remix-debug').EthDebugger
if (typeof (module) !== 'undefined' && typeof (module.exports) !== 'undefined') {
module.exports = modules()
}
if (typeof (window) !== 'undefined') {
window.remix = modules()
}
function modules () {
return {
ui: {
Debugger: Debugger,
VMdebugger: VMDebugger,
DebuggerBackend
}
}
}
/* global XMLHttpRequest */
function loadJSON (url, callback) {
var xobj = new XMLHttpRequest()
xobj.overrideMimeType('application/json')
xobj.open('GET', url, true)
xobj.onreadystatechange = function () {
if (xobj.readyState === 4 && xobj.status === 200) {
callback(xobj.responseText)
}
}
xobj.send(null)
}
function loadTestWeb3 (data) {
var container = document.getElementById('app')
var vmdebugger = container.debugger.debugger
var uiTestweb3 = {}
uiTestweb3.eth = {}
uiTestweb3.debug = {}
uiTestweb3.eth.getCode = function (address, callback) {
if (callback) {
callback(null, data.testCodes[address])
} else {
return data.testCodes[address]
}
}
uiTestweb3.debug.traceTransaction = function (txHash, options, callback) {
callback(null, data.testTraces[txHash])
}
uiTestweb3.debug.storageRangeAt = function (blockNumber, txIndex, address, start, size, callback) {
callback(null, { storage: {}, complete: true })
}
uiTestweb3.eth.getTransaction = function (txHash, callback) {
if (callback) {
callback(null, data.testTxs[txHash])
} else {
return data.testTxs[txHash]
}
}
uiTestweb3.eth.getTransactionFromBlock = function (blockNumber, txIndex, callback) {
if (callback) {
callback(null, data.testTxsByBlock[blockNumber + '-' + txIndex])
} else {
return data.testTxsByBlock[blockNumber + '-' + txIndex]
}
}
uiTestweb3.eth.getBlockNumber = function (callback) { callback(null, 'web3 modified for testing purposes :)') }
uiTestweb3.providers = { 'HttpProvider': function (url) {} }
uiTestweb3.setProvider = function (provider) {}
uiTestweb3.currentProvider = {host: 'web3 modified for testing purposes :)'}
vmdebugger.addProvider('TEST', uiTestweb3)
vmdebugger.switchProvider('TEST')
container.debugger.updateWeb3Reference(uiTestweb3)
}
function waitForRemix (data) {
setTimeout(function () {
if (!document.getElementById('app').debugger) {
waitForRemix(data)
} else {
loadTestWeb3(data)
}
}, 500)
}
console.log('injecting test web3...')
loadJSON('/test-browser-debugger/resources/testWeb3.json', function (result) {
var data = JSON.parse(result)
waitForRemix(data)
})
module.exports = function (browser, callback) {
extendBrowser(browser)
browser
.url('http://127.0.0.1:8080')
.injectScript('test-browser/resources/insertTestWeb3.js', function () {
// wait for the script to load test web3...
setTimeout(function () {
callback()
}, 5000)
})
}
function extendBrowser (browser) {
browser.multipleClick = function (id, time) {
for (var k = 0; k < time; k++) {
browser.click(id)
}
return browser
}
browser.assertCurrentSelectedItem = function (expected) {
browser.execute(function (id) {
var node = document.querySelector('#asmcodes div div[selected="selected"] span')
return node.innerText
}, [''], function (returnValue) {
browser.assert.equal(returnValue.value, expected)
})
return browser
}
browser.retrieveInnerText = function (selector, callback) {
browser.execute(function (selector) {
var node = document.querySelector(selector)
return node ? node.innerText : ''
}, [selector], function (returnValue) {
callback(returnValue.value)
})
return browser
}
browser.assertStepDetail = function (vmtracestepinfo, stepinfo, addmemoryinfo, gasinfo, remaininggasinfo, loadedaddressinfo) {
assertPanel('#stepdetail', browser, ['vmtracestep:' + vmtracestepinfo, 'executionstep:' + stepinfo, 'addmemory:' + addmemoryinfo, 'gas:' + gasinfo, 'remaininggas:' + remaininggasinfo, 'loadedaddress:' + loadedaddressinfo])
return browser
}
browser.assertStack = function (value) {
return assertPanel('#stackpanel', browser, value)
}
browser.assertStorageChanges = function (value) {
return assertPanel('#storagepanel', browser, value)
}
browser.assertMemory = function (value) {
return assertPanel('#memorypanel', browser, value)
}
browser.assertCallData = function (value) {
return assertPanel('#calldatapanel', browser, value)
}
browser.assertCallStack = function (value) {
return assertPanel('#callstackpanel', browser, value)
}
browser.assertStackValue = function (index, value) {
return assertPanelValue('#stackpanel', browser, index, value)
}
browser.assertStorageChangesValue = function (index, value) {
return assertPanelValue('#storagepanel', browser, index, value)
}
browser.assertMemoryValue = function (index, value) {
return assertPanelValue('#memorypanel', browser, index, value)
}
browser.assertCallStackValue = function (index, value) {
return assertPanelValue('#callstackpanel', browser, index, value)
}
browser.debugerKeyCode = {
'Enter': 13,
'Up': 38,
'Down': 40,
'Right': '39',
'Left': 37,
'Esc': 27,
'SpaceBar': 32,
'Ctrl': 17,
'Alt': 18,
'Shift': 16
}
/* browser.sendKeys is not working for safari */
/* still not working properly
browser.fireEvent = function (el, key, times, callback) {
var data = {
'id': el.substring(1),
'key': key,
'times': times
}
browser.execute(function (data) {
data = JSON.parse(data)
var el = document.getElementById(data.id)
var eventObj
console.log(el)
console.log(data)
var k = 0
if (document.createEventObject) {
eventObj = document.createEventObject()
eventObj.keyCode = data.key
while (k < data.times) {
console.log('firing brfore createEventObject')
el.fireEvent('onkeypress', eventObj)
console.log('firing')
k++
}
} else if (typeof (KeyboardEvent) === 'function') {
eventObj = new KeyboardEvent('keyup')
eventObj.key = data.key
eventObj.which = data.key
while (k < data.times) {
console.log('firing brfore createEvent')
el.dispatchEvent(eventObj)
console.log('firing')
k++
}
}
}, [JSON.stringify(data)], function () {
callback()
})
}
*/
}
function assertPanel (id, browser, value) {
var selector = '.dropdownpanel div.dropdowncontent ul'
browser.execute(function (id, selector) {
var el = document.getElementById(id.replace('#', '').replace('.', ''))
var node = el.querySelector(selector)
var ret = []
for (var k = 0; k < node.children.length; k++) {
if (node.children[k].innerText) {
ret.push(node.children[k].innerText)
}
}
return ret
}, [id, selector], function (returnValues) {
value.map(function (item, index) {
if (returnValues.value.length) {
var testValue = returnValues.value[index].replace(/\r\n/g, '').replace(/\t/g, '').replace(/\s/g, '')
browser.assert.equal(testValue, value[index])
} else {
browser.assert.equal(item, '')
}
})
})
return browser
}
function assertPanelValue (id, browser, index, value) {
var selector = id + ' .dropdownpanel .dropdowncontent ul'
browser.execute(function (id, index) {
var node = document.querySelector(id)
return node.children[index].innerText
}, [selector, index], function (returnValues) {
var testValue = returnValues.value.replace(/\r\n/g, '').replace(/\t/g, '').replace(/\s/g, '')
browser.assert.equal(testValue, value)
})
return browser
}
const https = require('https')
module.exports = function sauce (callback) {
const currentTest = this.client.currentTest
const username = this.client.options.username
const sessionId = this.client.capabilities['webdriver.remote.sessionid']
const accessKey = this.client.options.accessKey
if (!this.client.launch_url.match(/saucelabs/)) {
console.log('Not saucelabs ...')
return callback()
}
if (!username || !accessKey || !sessionId) {
console.log(this.client)
console.log('No username, accessKey or sessionId')
return callback()
}
const passed = currentTest.results.passed === currentTest.results.tests
const data = JSON.stringify({passed})
const requestPath = `/rest/v1/${username}/jobs/${sessionId}`
function responseCallback (res) {
res.setEncoding('utf8')
console.log('Response: ', res.statusCode, JSON.stringify(res.headers))
res.on('data', function onData (chunk) {
console.log('BODY: ' + chunk)
})
res.on('end', function onEnd () {
console.info('Finished updating saucelabs')
callback()
})
}
try {
console.log('Updating saucelabs', requestPath)
const req = https.request({
hostname: 'saucelabs.com',
path: requestPath,
method: 'PUT',
auth: `${username}:${accessKey}`,
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
}, responseCallback)
req.on('error', function onError (e) {
console.log('problem with request: ' + e.message)
})
req.write(data)
req.end()
} catch (error) {
console.log('Error', error)
callback()
}
}
'use strict'
var init = require('./init')
var sauce = require('./sauce')
module.exports = {
beforeEach: function (browser, done) {
try {
init(browser, function () {
done()
})
} catch (e) {
var mes = 'error ' + e.message
console.log(mes)
done(mes)
}
},
'vmdebugger': function (browser) {
loadTraceNotFound(browser)
.click('#unload')
loadTrace(browser)
.click('#unload')
panels(browser)
.click('#unload')
slider(browser)
.click('#unload')
stepping(browser)
.click('#unload')
stepdetail(browser)
.end()
},
tearDown: sauce
}
function loadTraceNotFound (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942zcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.click('#txinfo .title')
.execute(function () {
return document.querySelector('#txinfo .dropdownpanel .dropdownrawcontent').innerHTML
}, [], function (result) {
console.log(result.value)
if (result.value.indexOf('not found') === -1) {
browser.assert.fail(' txinput panel does not contain <not found> ', 'info about error', '')
}
})
return browser
}
function loadTrace (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.click('#txinfo .title')
.execute(function () {
return document.querySelector('#txinfo .dropdownpanel .dropdownrawcontent').innerHTML
}, [], function (result) {
if (result.value.indexOf('0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51') === -1) {
browser.assert.fail(' txinput panel does not contain 0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51 ', 'info about error', '')
}
})
.click('#unload')
.waitForElementNotVisible('#vmdebugger', 1000)
return browser
}
function panels (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.multipleClick('#intoforward', 63)
.assertStack(['0:0x', '1:0x60', '2:0x65', '3:0x38', '4:0x55', '5:0x60fe47b1'])
.assertStorageChanges(['0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563:Objectkey:0x00value:0x38'])
.assertCallData(['0:0x60fe47b10000000000000000000000000000000000000000000000000000000000000038'])
.assertCallStack(['0:0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'])
.assertStackValue(1, '1:0x60')
.assertMemoryValue(6, '0x60:60606040526040516020806045833981????R??Q????E?9?')
.assertMemoryValue(7, '0x70:01604052808051906020019091905050???R??Q???????PP')
.assertMemoryValue(8, '0x80:5b806001016000600050819055505b50?????????P??UP?P')
.click('#intoforward') // CREATE
.assertStack([''])
.assertStorageChanges([])
.assertMemory([''])
.assertCallData(['0:0x0000000000000000000000000000000000000000000000000000000000000000000000000000006060606040526040516020806045833981016040528080519060200190919050505b806001016000600050819055'])
.assertCallStack(['0:0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', '1:(ContractCreation-Step63)'])
return browser
}
function slider (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
/*
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.LEFT_ARROW)
*/
.assertCurrentSelectedItem('041 PUSH4 60fe47b1')
return browser
}
function stepping (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.click('#intoforward')
.click('#intoforward')
.assertCurrentSelectedItem('004 MSTORE')
.click('#intoforward')
.click('#intoback')
.click('#intoback')
.assertCurrentSelectedItem('002 PUSH1 40')
.multipleClick('#intoforward', 62)
.assertCurrentSelectedItem('181 CREATE')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#overforward')
.assertCurrentSelectedItem('007 MLOAD')
.click('#intoback')
.click('#intoback')
.click('#intoback')
.click('#intoback')
.click('#intoback')
.click('#overforward')
.assertCurrentSelectedItem('182 PUSH1 01')
.click('#overforward')
.assertCurrentSelectedItem('184 PUSH1 00')
.click('#intoback')
.click('#intoback')
.click('#overback')
.assertCurrentSelectedItem('181 CREATE')
return browser
}
function stepdetail (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
/*
.fireEvent('#slider', browser.debugerKeyCode.Right, 4, function () {
browser.assertSticker('6', '6', '', '3', '84476', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.click('#nextcall')
.assertSticker('63', '63', '', '32000', '79283', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.click('#intoforward')
.click('#overforward')
.assertSticker('108', '44', '', '0', '27145', '(Contract Creation - Step 63)')
.click('#intoforward')
.assertSticker('109', '64', '', '3', '25145', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.end()
})
*/
.assertStepDetail('6', '6', '', '3', '84476', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.multipleClick('#intoforward', 57)
.assertStepDetail('63', '63', '', '32000', '79283', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.click('#overforward')
.click('#intoback')
.assertStepDetail('108', '44', '', '0', '27145', '(ContractCreation-Step63)')
.click('#intoforward')
.assertStepDetail('109', '64', '', '3', '25145', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
return browser
}
module.exports = function (browser, callback) {
extendBrowser(browser)
browser
.url('http://127.0.0.1:8080')
.injectScript('test-browser-debugger/resources/insertTestWeb3.js', function () {
// wait for the script to load test web3...
console.log('waiting for script ..')
setTimeout(function () {
callback()
}, 5000)
})
}
function extendBrowser (browser) {
browser.multipleClick = function (id, time) {
for (var k = 0; k < time; k++) {
browser.click(id)
}
return browser
}
browser.assertCurrentSelectedItem = function (expected) {
browser.execute(function (id) {
var node = document.querySelector('#asmcodes div div[selected="selected"] span')
return node.innerText
}, [''], function (returnValue) {
browser.assert.equal(returnValue.value, expected)
})
return browser
}
browser.retrieveInnerText = function (selector, callback) {
browser.execute(function (selector) {
var node = document.querySelector(selector)
return node ? node.innerText : ''
}, [selector], function (returnValue) {
callback(returnValue.value)
})
return browser
}
browser.assertStepDetail = function (vmtracestepinfo, stepinfo, addmemoryinfo, gasinfo, remaininggasinfo, loadedaddressinfo) {
assertPanel('#stepdetail', browser, ['vmtracestep:' + vmtracestepinfo, 'executionstep:' + stepinfo, 'addmemory:' + addmemoryinfo, 'gas:' + gasinfo, 'remaininggas:' + remaininggasinfo, 'loadedaddress:' + loadedaddressinfo])
return browser
}
browser.assertStack = function (value) {
return assertPanel('#stackpanel', browser, value)
}
browser.assertStorageChanges = function (value) {
return assertPanel('#storagepanel', browser, value)
}
browser.assertMemory = function (value) {
return assertPanel('#memorypanel', browser, value)
}
browser.assertCallData = function (value) {
return assertPanel('#calldatapanel', browser, value)
}
browser.assertCallStack = function (value) {
return assertPanel('#callstackpanel', browser, value)
}
browser.assertStackValue = function (index, value) {
return assertPanelValue('#stackpanel', browser, index, value)
}
browser.assertStorageChangesValue = function (index, value) {
return assertPanelValue('#storagepanel', browser, index, value)
}
browser.assertMemoryValue = function (index, value) {
return assertPanelValue('#memorypanel', browser, index, value)
}
browser.assertCallStackValue = function (index, value) {
return assertPanelValue('#callstackpanel', browser, index, value)
}
browser.debugerKeyCode = {
'Enter': 13,
'Up': 38,
'Down': 40,
'Right': '39',
'Left': 37,
'Esc': 27,
'SpaceBar': 32,
'Ctrl': 17,
'Alt': 18,
'Shift': 16
}
/* browser.sendKeys is not working for safari */
/* still not working properly
browser.fireEvent = function (el, key, times, callback) {
var data = {
'id': el.substring(1),
'key': key,
'times': times
}
browser.execute(function (data) {
data = JSON.parse(data)
var el = document.getElementById(data.id)
var eventObj
console.log(el)
console.log(data)
var k = 0
if (document.createEventObject) {
eventObj = document.createEventObject()
eventObj.keyCode = data.key
while (k < data.times) {
console.log('firing brfore createEventObject')
el.fireEvent('onkeypress', eventObj)
console.log('firing')
k++
}
} else if (typeof (KeyboardEvent) === 'function') {
eventObj = new KeyboardEvent('keyup')
eventObj.key = data.key
eventObj.which = data.key
while (k < data.times) {
console.log('firing brfore createEvent')
el.dispatchEvent(eventObj)
console.log('firing')
k++
}
}
}, [JSON.stringify(data)], function () {
callback()
})
}
*/
}
function assertPanel (id, browser, value) {
var selector = '.dropdownpanel div.dropdowncontent ul'
browser.execute(function (id, selector) {
var el = document.getElementById(id.replace('#', '').replace('.', ''))
var node = el.querySelector(selector)
var ret = []
for (var k = 0; k < node.children.length; k++) {
if (node.children[k].innerText) {
ret.push(node.children[k].innerText)
}
}
return ret
}, [id, selector], function (returnValues) {
value.map(function (item, index) {
if (returnValues.value.length) {
var testValue = returnValues.value[index].replace(/\r\n/g, '').replace(/\t/g, '').replace(/\s/g, '')
browser.assert.equal(testValue, value[index])
} else {
browser.assert.equal(item, '')
}
})
})
return browser
}
function assertPanelValue (id, browser, index, value) {
var selector = id + ' .dropdownpanel .dropdowncontent ul'
browser.execute(function (id, index) {
var node = document.querySelector(id)
return node.children[index].innerText
}, [selector, index], function (returnValues) {
var testValue = returnValues.value.replace(/\r\n/g, '').replace(/\t/g, '').replace(/\s/g, '')
browser.assert.equal(testValue, value)
})
return browser
}
const https = require('https')
module.exports = function sauce (callback) {
const currentTest = this.client.currentTest
const username = this.client.options.username
const sessionId = this.client.capabilities['webdriver.remote.sessionid']
const accessKey = this.client.options.accessKey
if (!this.client.launch_url.match(/saucelabs/)) {
console.log('Not saucelabs ...')
return callback()
}
if (!username || !accessKey || !sessionId) {
console.log(this.client)
console.log('No username, accessKey or sessionId')
return callback()
}
const passed = currentTest.results.passed === currentTest.results.tests
const data = JSON.stringify({passed})
const requestPath = `/rest/v1/${username}/jobs/${sessionId}`
function responseCallback (res) {
res.setEncoding('utf8')
console.log('Response: ', res.statusCode, JSON.stringify(res.headers))
res.on('data', function onData (chunk) {
console.log('BODY: ' + chunk)
})
res.on('end', function onEnd () {
console.info('Finished updating saucelabs')
callback()
})
}
try {
console.log('Updating saucelabs', requestPath)
const req = https.request({
hostname: 'saucelabs.com',
path: requestPath,
method: 'PUT',
auth: `${username}:${accessKey}`,
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
}, responseCallback)
req.on('error', function onError (e) {
console.log('problem with request: ' + e.message)
})
req.write(data)
req.end()
} catch (error) {
console.log('Error', error)
callback()
}
}
'use strict'
var init = require('./init')
var sauce = require('./sauce')
module.exports = {
beforeEach: function (browser, done) {
try {
init(browser, function () {
done()
})
} catch (e) {
var mes = 'error ' + e.message
console.log(mes)
done(mes)
}
},
'vmdebugger': function (browser) {
loadTraceNotFound(browser)
.click('#unload')
panels(browser)
.click('#unload')
slider(browser)
.click('#unload')
stepping(browser)
.click('#unload')
stepdetail(browser)
.end()
},
tearDown: sauce
}
function loadTraceNotFound (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942zcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.execute(function () {
return document.querySelector('div[class^="container"] #error').innerHTML
}, [], function (result) {
console.log(result.value)
if (result.value.indexOf('0x20ef65b8b186ca942zcccd634f37074dde49b541c27994fc7596740ef44cfd51') === -1) {
browser.assert.fail(' error with transaction hash should have been displayed', 'info about error', '')
}
})
return browser
}
function panels (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.multipleClick('#intoforward', 63)
.assertStack(['0:0x00', '1:0x60', '2:0x65', '3:0x38', '4:0x55', '5:0x60fe47b1'])
.assertStorageChanges(['0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563:Object'])
.assertCallData(['0:0x60fe47b10000000000000000000000000000000000000000000000000000000000000038'])
.assertCallStack(['0:0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5'])
.assertStackValue(1, '1:0x60')
.assertMemoryValue(6, '0x60:60606040526040516020806045833981????R??Q????E?9?')
.assertMemoryValue(7, '0x70:01604052808051906020019091905050???R??Q???????PP')
.assertMemoryValue(8, '0x80:5b806001016000600050819055505b50?????????P??UP?P')
.click('#intoforward') // CREATE
.assertStack([''])
.assertStorageChanges([])
.assertMemory([''])
.assertCallData(['0:0x0000000000000000000000000000000000000000000000000000000000000000000000000000006060606040526040516020806045833981016040528080519060200190919050505b806001016000600050819055'])
.assertCallStack(['0:0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', '1:(ContractCreation-Step63)'])
return browser
}
function slider (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
/*
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.RIGHT_ARROW)
.sendKeys('#slider', browser.Keys.LEFT_ARROW)
*/
.assertCurrentSelectedItem('041 PUSH4 60fe47b1')
return browser
}
function stepping (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.click('#intoforward')
.click('#intoforward')
.assertCurrentSelectedItem('004 MSTORE')
.click('#intoforward')
.click('#intoback')
.click('#intoback')
.assertCurrentSelectedItem('002 PUSH1 40')
.multipleClick('#intoforward', 62)
.assertCurrentSelectedItem('181 CREATE')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#overforward')
.assertCurrentSelectedItem('007 MLOAD')
.click('#intoback')
.click('#intoback')
.click('#intoback')
.click('#intoback')
.click('#intoback')
.click('#overforward')
.assertCurrentSelectedItem('182 PUSH1 01')
.click('#overforward')
.assertCurrentSelectedItem('184 PUSH1 00')
.click('#intoback')
.click('#intoback')
.click('#overback')
.assertCurrentSelectedItem('181 CREATE')
return browser
}
function stepdetail (browser) {
browser
.clearValue('#txinput')
.setValue('#txinput', '0x20ef65b8b186ca942fcccd634f37074dde49b541c27994fc7596740ef44cfd51')
.click('#load')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
.click('#intoforward')
/*
.fireEvent('#slider', browser.debugerKeyCode.Right, 4, function () {
browser.assertSticker('6', '6', '', '3', '84476', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.click('#nextcall')
.assertSticker('63', '63', '', '32000', '79283', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.click('#intoforward')
.click('#overforward')
.assertSticker('108', '44', '', '0', '27145', '(Contract Creation - Step 63)')
.click('#intoforward')
.assertSticker('109', '64', '', '3', '25145', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.end()
})
*/
.assertStepDetail('6', '6', '', '3', '84476', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.multipleClick('#intoforward', 57)
.assertStepDetail('63', '63', '', '32000', '79283', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
.click('#overforward')
.click('#intoback')
.assertStepDetail('108', '44', '', '0', '27145', '(ContractCreation-Step63)')
.click('#intoforward')
.assertStepDetail('109', '64', '', '3', '25145', '0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
return browser
}
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var RemixExtension = function () {
function RemixExtension() {
var _this = this;
_classCallCheck(this, RemixExtension);
this._notifications = {};
this._pendingRequests = {};
this._id = 0;
window.addEventListener('message', function (event) {
return _this._newMessage(event);
}, false);
}
_createClass(RemixExtension, [{
key: 'listen',
value: function listen(key, type, callback) {
if (!this._notifications[key]) this._notifications[key] = {};
this._notifications[key][type] = callback;
}
}, {
key: 'call',
value: function call(key, type, params, callback) {
this._id++;
this._pendingRequests[this._id] = callback;
window.parent.postMessage(JSON.stringify({
action: 'request',
key: key,
type: type,
value: params,
id: this._id
}), '*');
}
}, {
key: '_newMessage',
value: function _newMessage(event) {
if (!event.data) return;
if (typeof event.data !== 'string') return;
var msg;
try {
msg = JSON.parse(event.data);
} catch (e) {
return console.log('unable to parse data');
}
var _msg = msg,
action = _msg.action,
key = _msg.key,
type = _msg.type,
value = _msg.value;
if (action === 'notification') {
if (this._notifications[key] && this._notifications[key][type]) {
this._notifications[key][type](value);
}
} else if (action === 'response') {
var _msg2 = msg,
id = _msg2.id,
error = _msg2.error;
if (this._pendingRequests[id]) {
this._pendingRequests[id](error, value);
delete this._pendingRequests[id];
}
}
}
}]);
return RemixExtension;
}();
if (window) window.RemixExtension = RemixExtension;
if (module && module.exports) module.exports = RemixExtension;
},{}]},{},[1]);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--
The MIT License (MIT)
Copyright (c) 2014, 2015, the individual contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title></title>
<link rel="stylesheet" href="assets/css/pygment_trac.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<script type="text/javascript" src="remix.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
<div>PLUGIN</div>
<input type="text" id="filename"></input>
<input type="text" id="valuetosend"></input> <br>
<input type="button" id="testmessageadd">add config</input> <br>
<input type="button" id="testmessageremove">remove config</input> <br>
<input type="button" id="testmessagerget">get config</input> <br>
<input type="button" id="testcontractcreation">oraclize contract creation</input> <br>
<input type="button" id="testaccountcreation">account creation</input> <br>
<input type="button" id="testchangetitle">change title</input> <br>
<br>
<div id='compilationdata'></div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!--
The MIT License (MIT)
Copyright (c) 2014, 2015, the individual contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title></title>
<link rel="stylesheet" href="assets/css/pygment_trac.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<script type="text/javascript" src="bundle.js"></script>
<script type="text/javascript" src="plugin.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
<div>PLUGIN</div>
<input type="text" id="filename"></input>
<input type="text" id="valuetosend"></input> <input type="text" id="valuetosend2"></input> <br>
<input type="button" id="testmessageadd">add config</input> <br>
<input type="button" id="testmessageremove">remove config</input> <br>
<input type="button" id="testmessagerget">get config</input> <br>
<input type="button" id="testcontractcreation">oraclize contract creation</input> <br>
<input type="button" id="testaccountcreation">account creation</input> <br>
<input type="button" id="testchangetitle">change title</input> <br>
<input type="button" id="setcontentof">set content of</input> <br>
<input type="button" id="getcontentof">get content of</input> <br>
<input type="button" id="getcurrent">get current</input> <br>
<input type="button" id="sethighlight">set highlight</input> <br>
<input type="button" id="getFolder">get files from path</input> <br>
<input type="button" id="addnetwork">add network</input> <br>
<input type="button" id="removenetwork">remove network</input> <br>
<br>
<div id='compilationdata'></div>
</body>
</html>
/*
test contract creation
*/
var addrResolverByteCode = '0x6060604052341561000f57600080fd5b33600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061033c8061005f6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806338cc483114610067578063767800de146100bc578063a6f9dae114610111578063d1d80fdf1461014a575b600080fd5b341561007257600080fd5b61007a610183565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100c757600080fd5b6100cf6101ac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561011c57600080fd5b610148600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506101d1565b005b341561015557600080fd5b610181600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610271565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561022d57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102cd57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058201b23355f578cb9a23c0a43a440ab2631b62df7be0a8e759812a70f01344224da0029'
const addrResolverTx = {
gasLimit: '3000000',
from: '0xca35b7d915458ef540ade6068dfe2f44e8fa733c',
data: addrResolverByteCode,
value: '0',
useCall: false
}
var extension = new window.RemixExtension()
window.onload = function () {
extension.listen('compiler', 'compilationFinished', function () {
console.log(arguments)
})
setInterval(function () {
extension.call('network', 'detectNetWork', [], function (error, result) {
console.log(error, result)
})
}, 5000)
document.querySelector('input#testmessageadd').addEventListener('click', function () {
extension.call('config', 'setConfig', [document.getElementById('filename').value, document.getElementById('valuetosend').value],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#testmessageremove').addEventListener('click', function () {
extension.call('config', 'removeConfig', [document.getElementById('filename').value],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#testmessagerget').addEventListener('click', function () {
extension.call('config', 'getConfig', [document.getElementById('filename').value],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#testcontractcreation').addEventListener('click', function () {
extension.call('udapp', 'runTx', [addrResolverTx],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#testaccountcreation').addEventListener('click', function () {
extension.call('udapp', 'createVMAccount', [{
privateKey: '71975fbf7fe448e004ac7ae54cad0a383c3906055a75468714156a07385e96ce',
balance: '0x56BC75E2D63100000'
}],
function (error, result) { console.log(error, result) })
})
var k = 0
document.querySelector('input#testchangetitle').addEventListener('click', function () {
extension.call('app', 'updateTitle', ['changed title ' + k++],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#setcontentof').addEventListener('click', function () {
extension.call('editor', 'setFile', [document.getElementById('filename').value, document.getElementById('valuetosend').value],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#getcontentof').addEventListener('click', function () {
extension.call('editor', 'getFile', [document.getElementById('filename').value],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#getcurrent').addEventListener('click', function () {
extension.call('editor', 'getCurrentFile', [],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#sethighlight').addEventListener('click', function () {
extension.call('editor', 'highlight', [document.getElementById('filename').value, document.getElementById('valuetosend').value, document.getElementById('valuetosend2').value],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#getFolder').addEventListener('click', function () {
extension.call('fileManager', 'getFolder', [document.getElementById('filename').value],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#addnetwork').addEventListener('click', function () {
extension.call('network', 'addProvider', [document.getElementById('filename').value, document.getElementById('valuetosend').value],
function (error, result) { console.log(error, result) })
})
document.querySelector('input#removenetwork').addEventListener('click', function () {
extension.call('network', 'removeProvider', [document.getElementById('filename').value],
function (error, result) { console.log(error, result) })
})
}
/*
test contract creation
*/
var addrResolverByteCode = '0x6060604052341561000f57600080fd5b33600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061033c8061005f6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806338cc483114610067578063767800de146100bc578063a6f9dae114610111578063d1d80fdf1461014a575b600080fd5b341561007257600080fd5b61007a610183565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100c757600080fd5b6100cf6101ac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561011c57600080fd5b610148600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506101d1565b005b341561015557600080fd5b610181600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610271565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561022d57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156102cd57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058201b23355f578cb9a23c0a43a440ab2631b62df7be0a8e759812a70f01344224da0029'
const addrResolverTx = {
gasLimit: '0x2710',
from: '0xca35b7d915458ef540ade6068dfe2f44e8fa733c',
data: addrResolverByteCode,
value: '0x00',
useCall: false
}
function receiveMessage (event) {
console.log('receiveMessage', event.data, event.source, event.origin)
document.getElementById('compilationdata').innerHTML += event.data + '<br>'
}
window.addEventListener('message', receiveMessage, false)
window.onload = function () {
document.querySelector('input#testmessageadd').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'config',
type: 'setConfig',
value: [document.getElementById('filename').value, document.getElementById('valuetosend').value],
id: 34
}), '*')
})
document.querySelector('input#testmessageremove').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'config',
type: 'removeConfig',
value: [document.getElementById('filename').value],
id: 35
}), '*')
})
document.querySelector('input#testmessagerget').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'config',
type: 'getConfig',
value: [document.getElementById('filename').value],
id: 36
}), '*')
})
document.querySelector('input#testcontractcreation').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'udapp',
type: 'runTx',
value: [addrResolverTx],
id: 37
}), '*')
})
document.querySelector('input#testaccountcreation').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'udapp',
type: 'createVMAccount',
value: [{
privateKey: '71975fbf7fe448e004ac7ae54cad0a383c3906055a75468714156a07385e96ce',
balance: '0x56BC75E2D63100000'
}],
id: 38
}), '*')
})
var k = 0
document.querySelector('input#testchangetitle').addEventListener('click', function () {
window.parent.postMessage(JSON.stringify({
action: 'request',
key: 'app',
type: 'updateTitle',
value: ['changed title ' + k++],
id: 39
}), '*')
})
}
......@@ -38,7 +38,7 @@ module.exports = {
'@sources': function () {
return sources
},
'Test Shared Folder Explorer': function (browser) {
'Remixd': function (browser) {
runTests(browser)
},
tearDown: sauce
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment