From fb22fb12cafec238a2143df6e94218c890e4ba4e Mon Sep 17 00:00:00 2001 From: Sneh Koul <35871990+Sneh1999@users.noreply.github.com> Date: Tue, 16 Apr 2019 10:59:11 -0700 Subject: Adds e2e test for most web3 methods that dapps use (#6160) * schema added * ui for the dapp added and schema.js changed according to the comments in PR * added tests for all web3 methods * Update run-all.sh * Update web3.spec.js to work with new onboarding flow * changes made according to the comments * Create stand alone script for web3 e2e tests. * Lint fixes for web3 e2e tests. --- test/web3/web3.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/web3/web3.js (limited to 'test/web3/web3.js') diff --git a/test/web3/web3.js b/test/web3/web3.js new file mode 100644 index 000000000..5c2de078d --- /dev/null +++ b/test/web3/web3.js @@ -0,0 +1,34 @@ +/* eslint no-undef: 0 */ + +var json = methods + +web3.currentProvider.enable().then(() => { + + Object.keys(json).forEach(methodGroupKey => { + + console.log(methodGroupKey) + const methodGroup = json[methodGroupKey] + console.log(methodGroup) + Object.keys(methodGroup).forEach(methodKey => { + + const methodButton = document.getElementById(methodKey) + methodButton.addEventListener('click', function (event) { + + window.ethereum.sendAsync({ + method: methodKey, + params: methodGroup[methodKey][1], + }, function (err, result) { + if (err) { + console.log(err) + console.log(methodKey) + } else { + document.getElementById('results').innerHTML = JSON.stringify(result) + } + }) + }) + + }) + + }) + }) + -- cgit