Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting UI E2E #49

Merged
merged 14 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ jobs:
- checkout
- setup_remote_docker
- run: yarn run oracle-e2e
ui-e2e:
docker:
- image: circleci/node:10.15-browsers
steps:
- checkout
- run: git submodule update --init
- run: yarn
- setup_remote_docker
- run: yarn run ui-e2e

workflows:
version: 2
Expand All @@ -49,3 +58,4 @@ workflows:
- test
- ansible-lint
- oracle-e2e
# - ui-e2e
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Sub-repositories maintained within this monorepo are listed below.
| [UI](ui/README.md) | DApp interface to transfer tokens and coins between chains. |
| [Monitor](monitor/README.md) | Tool for checking balances and unprocessed events in bridged networks. |
| [Deployment](deployment/README.md) | Ansible playbooks for deploying cross-chain bridges. |
| [Oracle-E2E]() | End to end tests for the Oracle |
| [UI-E2E]() | End to end tests for the UI |

Additionally there are [Solidity contracts](https://github.com/poanetwork/poa-bridge-contracts) used to manage bridge validators, collect signatures, and confirm asset relay and disposal.

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
"oracle",
"oracle-e2e",
"ui",
"ui-e2e",
"monitor",
"contracts"
],
"scripts": {
"build": "yarn workspace poa-parity-bridge-contracts run compile && yarn workspace ui run build",
"lint": "yarn wsrun --exclude oracle-e2e --exclude poa-parity-bridge-contracts lint",
"test": "yarn wsrun --exclude monitor --exclude oracle-e2e test",
"lint": "yarn wsrun --exclude oracle-e2e --exclude ui-e2e --exclude poa-parity-bridge-contracts lint",
"test": "yarn wsrun --exclude monitor --exclude oracle-e2e --exclude ui-e2e test",
"ansible-lint": "./deployment/lint.sh",
"oracle-e2e": "./oracle-e2e/run-tests.sh",
"ui-e2e": "./ui-e2e/run-tests.sh",
"clean": "rm -rf ./node_modules ./**/node_modules",
"postinstall": "ln -s $(pwd)/node_modules/openzeppelin-solidity/ contracts/node_modules/openzeppelin-solidity"
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ui/e2e-script/MetaMask.js → ui-e2e/MetaMask.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ class MetaMask extends Page {
let url;
switch (provider) {
case 77: {
url = "http://10.1.0.102:8545";
url = "http://localhost:8541";
networks.push(177);
break;
}
case 42: {
url = "http://10.1.0.103:8545";
url = "http://localhost:8542";
networks.push(142);
break;
}
Expand Down
File renamed without changes.
12 changes: 3 additions & 9 deletions ui/e2e-script/README.md → ui-e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### e2e script for bridge-ui
Configure startURL, homeAccount, foreignAccount in ```config.json```
### ui-e2e
End to end tests for the UI

- Configure startURL, homeAccount, foreignAccount in ```config.json```

#### Tests

Expand All @@ -16,11 +17,4 @@ Configure startURL, homeAccount, foreignAccount in ```config.json```
7. User is able to send tokens from Foreign account to Home account
8. Foreign POA balance has correctly changed after transaction
9. Home account has received correct amount of tokens after transaction

```






File renamed without changes.
4 changes: 2 additions & 2 deletions ui/e2e-script/Utils.js → ui-e2e/Utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const webdriver = require('selenium-webdriver'),
chrome = require('selenium-webdriver/chrome');
const fs = require('fs-extra');
const configFile = './e2e-script/config.json';
const configFile = './config.json';

class Utils {

Expand Down Expand Up @@ -51,7 +51,7 @@ class Utils {
}

static async startBrowserWithMetamask() {
let source = './e2e-script/MetaMask.crx';
let source = './MetaMask.crx';
let options = new chrome.Options();
await options.addExtensions(source);
await options.addArguments('disable-popup-blocking');
Expand Down
7 changes: 7 additions & 0 deletions ui-e2e/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"startUrl" : "http://localhost:3000",
"erc20Url" : "http://localhost:3001",
"erc20NativeUrl" : "http://localhost:3002",
"homeAccount": "./accounts/user77_7FC1.json",
"foreignAccount": "./accounts/user42_7FC1.json"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
64 changes: 12 additions & 52 deletions ui/e2e-script/docker-compose.yml → ui-e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,25 @@ version: '3'
services:
parity1:
build: parity
networks:
testnet:
ipv4_address: 10.1.0.102
ports:
- "8541:8545"
parity2:
build:
context: parity
dockerfile: Dockerfile-foreign
networks:
testnet:
ipv4_address: 10.1.0.103
ports:
- "8542:8545"
contracts:
build: contracts
networks:
- testnet
command: "true"
redis:
image: "redis:4"
networks:
- testnet
rabbit:
image: "rabbitmq:3-management"
networks:
- testnet
ports:
- "15672:15672"
bridge:
build: bridge
build: ../oracle
environment:
- NODE_ENV=production
- BRIDGE_MODE=NATIVE_TO_ERC
Expand All @@ -57,11 +45,9 @@ services:
- HOME_POLLING_INTERVAL=500
- FOREIGN_POLLING_INTERVAL=500
- ALLOW_HTTP=yes
networks:
- testnet
command: "true"
bridge-erc20:
build: bridge
build: ../oracle
environment:
- NODE_ENV=production
- BRIDGE_MODE=ERC_TO_ERC
Expand All @@ -87,11 +73,9 @@ services:
- HOME_POLLING_INTERVAL=500
- FOREIGN_POLLING_INTERVAL=500
- ALLOW_HTTP=yes
networks:
- testnet
command: "true"
bridge-erc20-native:
build: bridge
build: ../oracle
environment:
- NODE_ENV=production
- BRIDGE_MODE=ERC_TO_NATIVE
Expand All @@ -117,16 +101,14 @@ services:
- HOME_POLLING_INTERVAL=500
- FOREIGN_POLLING_INTERVAL=500
- ALLOW_HTTP=yes
networks:
- testnet
command: "true"
ui:
build: ..
build: ../ui
environment:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x32198D570fffC7033641F8A9094FFDCaAEF42624
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x2B6871b9B02F73fa24F4864322CdC78604207769
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://10.1.0.103:8545
- REACT_APP_HOME_HTTP_PARITY_URL=http://10.1.0.102:8545
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://localhost:8542
- REACT_APP_HOME_HTTP_PARITY_URL=http://localhost:8541
- REACT_APP_HOME_NATIVE_NAME=POA
- REACT_APP_HOME_NETWORK_NAME=Sokol
- REACT_APP_FOREIGN_NETWORK_NAME=Kovan
Expand All @@ -142,19 +124,14 @@ services:
- REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_FOREIGN_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
ports:
- "3000:3000"
networks:
testnet:
ipv4_address: 10.1.0.101
command: "true"
ui-erc20:
build: ..
build: ../ui
environment:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x1feB40aD9420b186F019A717c37f5546165d411E
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://10.1.0.103:8545
- REACT_APP_HOME_HTTP_PARITY_URL=http://10.1.0.102:8545
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://localhost:8542
- REACT_APP_HOME_HTTP_PARITY_URL=http://localhost:8541
- REACT_APP_HOME_NATIVE_NAME=POA
- REACT_APP_HOME_NETWORK_NAME=Sokol
- REACT_APP_FOREIGN_NETWORK_NAME=Kovan
Expand All @@ -170,19 +147,14 @@ services:
- REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_FOREIGN_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
ports:
- "3001:3000"
networks:
testnet:
ipv4_address: 10.1.0.104
command: "true"
ui-erc20-native:
build: ..
build: ../ui
environment:
- REACT_APP_HOME_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- REACT_APP_FOREIGN_BRIDGE_ADDRESS=0x488Af810997eD1730cB3a3918cD83b3216E6eAda
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://10.1.0.103:8545
- REACT_APP_HOME_HTTP_PARITY_URL=http://10.1.0.102:8545
- REACT_APP_FOREIGN_HTTP_PARITY_URL=http://localhost:8542
- REACT_APP_HOME_HTTP_PARITY_URL=http://localhost:8541
- REACT_APP_HOME_NATIVE_NAME=POA
- REACT_APP_HOME_NETWORK_NAME=Sokol
- REACT_APP_FOREIGN_NETWORK_NAME=Kovan
Expand All @@ -198,16 +170,4 @@ services:
- REACT_APP_FOREIGN_GAS_PRICE_SPEED_TYPE=standard
- REACT_APP_FOREIGN_GAS_PRICE_FALLBACK=5000000000
- REACT_APP_FOREIGN_GAS_PRICE_UPDATE_INTERVAL=15000
ports:
- "3002:3000"
networks:
testnet:
ipv4_address: 10.1.0.105
command: "true"
networks:
testnet:
driver: bridge
ipam:
driver: default
config:
- subnet: 10.1.0.0/24
File renamed without changes.
9 changes: 9 additions & 0 deletions ui-e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "ui-e2e",
"version": "0.0.1",
"license": "MIT",
"private": true,
"devDependencies": {
"mocha": "^5.1.1"
}
}
File renamed without changes.
File renamed without changes.
17 changes: 8 additions & 9 deletions ui/e2e-script/run-tests.sh → ui-e2e/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
cd $(dirname $0)
docker-compose up -d --build --force-recreate
cd ..
npm run start:blocks &
cd e2e-script
node ./scripts/blocks.js &

docker-compose run contracts ./deploy.sh
docker-compose run -d bridge npm run watcher:signature-request
docker-compose run -d bridge npm run watcher:collected-signatures
Expand All @@ -15,13 +15,12 @@ docker-compose run -d bridge-erc20-native npm run watcher:collected-signatures
docker-compose run -d bridge-erc20-native npm run watcher:affirmation-request
docker-compose run -d bridge npm run sender:home
docker-compose run -d bridge npm run sender:foreign
docker-compose run -d ui npm start
docker-compose run -d ui-erc20 npm start
docker-compose run -d ui-erc20-native npm start
cd ..
npm run startE2e
docker-compose run -d -p 3000:3000 ui npm start
docker-compose run -d -p 3001:3000 ui-erc20 npm start
docker-compose run -d -p 3002:3000 ui-erc20-native npm start

yarn mocha -b ./test.js
rc=$?
cd e2e-script
ps | grep node | grep -v grep | awk '{print "kill " $1}' | sh
docker-compose down
exit $rc
4 changes: 2 additions & 2 deletions ui/e2e-script/scripts/blocks.js → ui-e2e/scripts/blocks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Web3 = require('web3')

const homeWeb3 = new Web3(new Web3.providers.HttpProvider('http://10.1.0.102:8545'))
const foreignWeb3 = new Web3(new Web3.providers.HttpProvider('http://10.1.0.103:8545'))
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)
Expand Down
File renamed without changes.
14 changes: 0 additions & 14 deletions ui/e2e-script/bridge/Dockerfile

This file was deleted.

7 changes: 0 additions & 7 deletions ui/e2e-script/config.json

This file was deleted.

Loading