diff options
author | Sneh Koul <35871990+Sneh1999@users.noreply.github.com> | 2019-04-17 01:59:11 +0800 |
---|---|---|
committer | Dan J Miller <danjm.com@gmail.com> | 2019-04-17 01:59:11 +0800 |
commit | fb22fb12cafec238a2143df6e94218c890e4ba4e (patch) | |
tree | c44774b4aefae5b0866ea9f92d3e89fb4f34e55a /test/web3/web3.js | |
parent | 76075ac6528a6cca92b29cf024eb00ab25a6f9aa (diff) | |
download | tangerine-wallet-browser-fb22fb12cafec238a2143df6e94218c890e4ba4e.tar.gz tangerine-wallet-browser-fb22fb12cafec238a2143df6e94218c890e4ba4e.tar.zst tangerine-wallet-browser-fb22fb12cafec238a2143df6e94218c890e4ba4e.zip |
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.
Diffstat (limited to 'test/web3/web3.js')
-rw-r--r-- | test/web3/web3.js | 34 |
1 files changed, 34 insertions, 0 deletions
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) + } + }) + }) + + }) + + }) + }) + |