diff --git a/e2e-commons/scripts/blocks.js b/e2e-commons/scripts/blocks.js new file mode 100644 index 00000000..59467a99 --- /dev/null +++ b/e2e-commons/scripts/blocks.js @@ -0,0 +1,33 @@ +const Web3 = require('web3') + +const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8541')) +const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8542')) +const account = '0x7FC1442AB55Da569940Eb750AaD2BAA63DA4010E' +const privateKey = '0x460635eb4ac4287de2d2393985e19b4a9f948ac533453a1044ab8d50330b0df9' +homeWeb3.eth.accounts.wallet.add(privateKey) +foreignWeb3.eth.accounts.wallet.add(privateKey) + +function generateNewBlock(web3, address) { + return web3.eth.sendTransaction({ + from: address, + to: '0x0000000000000000000000000000000000000000', + gasPrice: '1', + gas: '21000', + value: '1' + }) +} + +function main() { + setTimeout(async () => { + generateNewBlock(homeWeb3, account) + generateNewBlock(foreignWeb3, account) + main() + }, 5000) +} + +main() + +process.on('SIGTERM', function () { + console.log('Finishing sending blocks...') + process.exit(0); +}); diff --git a/e2e-commons/up.sh b/e2e-commons/up.sh index a0cd5a19..90f10add 100755 --- a/e2e-commons/up.sh +++ b/e2e-commons/up.sh @@ -30,17 +30,13 @@ while [ "$1" != "" ]; do docker-compose run -d -p 3002:3000 ui-erc20-native yarn workspace ui run start fi - if [ "$1" == "oracle-deploy" ]; then - docker-compose run e2e yarn workspace oracle-e2e run deploy - fi - - if [ "$1" == "ui-deploy" ]; then - docker-compose run e2e yarn workspace ui-e2e run deploy - fi - if [ "$1" == "deploy" ]; then docker-compose run e2e e2e-commons/scripts/deploy.sh fi + if [ "$1" == "blocks" ]; then + node ./scripts/blocks.js & + fi + shift # Shift all the parameters down by one done diff --git a/ui-e2e/run-tests.sh b/ui-e2e/run-tests.sh index 1515fcc7..c995fc3b 100755 --- a/ui-e2e/run-tests.sh +++ b/ui-e2e/run-tests.sh @@ -1,9 +1,8 @@ #!/usr/bin/env bash cd $(dirname $0) -../e2e-commons/up.sh oracle ui deploy +../e2e-commons/up.sh oracle ui deploy blocks -node ./scripts/blocks.js & yarn mocha -b ./test.js rc=$? if [ $CI ]; then exit $rc; fi