From 03ab7b44b6b2b1c6fc61de16c10d99abb604288a Mon Sep 17 00:00:00 2001 From: rzadp Date: Tue, 4 Jun 2019 14:02:45 +0200 Subject: [PATCH] Common url and network ID --- e2e-commons/constants.json | 25 +++++++++++++++++-------- oracle-e2e/test/ercToErc.js | 6 +++--- oracle-e2e/test/ercToNative.js | 6 +++--- oracle-e2e/test/nativeToErc.js | 10 ++++------ ui-e2e/MetaMask.js | 6 +++--- ui-e2e/Utils.js | 15 ++++++--------- ui-e2e/config.json | 3 --- 7 files changed, 36 insertions(+), 35 deletions(-) diff --git a/e2e-commons/constants.json b/e2e-commons/constants.json index 3cb17bb0..0f5e87f2 100644 --- a/e2e-commons/constants.json +++ b/e2e-commons/constants.json @@ -11,22 +11,31 @@ "address": "0xaaB52d66283F7A1D5978bcFcB55721ACB467384b", "privateKey": "0x8e829f695aed89a154550f30262f1529582cc49dc30eff74a6b491359e0230f9" }, + "nativeToErcBridge": { + "home": "0x32198D570fffC7033641F8A9094FFDCaAEF42624", + "foreign": "0x2B6871b9B02F73fa24F4864322CdC78604207769", + "foreignToken": "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B", + "ui": "http://localhost:3000" + }, "ercToErcBridge": { "home": "0x1feB40aD9420b186F019A717c37f5546165d411E", "foreign": "0x4a58D6d8D416a5fBCAcf3dC52eb8bE8948E25127", "homeToken": "0x792455a6bCb62Ed4C4362D323E0590654CA4765c", - "foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f" + "foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f", + "ui": "http://localhost:3001" }, "ercToNativeBridge": { "home": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda", "foreign": "0x488Af810997eD1730cB3a3918cD83b3216E6eAda", - "foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f" + "foreignToken": "0x3C665A31199694Bf723fD08844AD290207B5797f", + "ui": "http://localhost:3002" }, - "nativeToErcBridge": { - "home": "0x32198D570fffC7033641F8A9094FFDCaAEF42624", - "foreign": "0x2B6871b9B02F73fa24F4864322CdC78604207769", - "foreignToken": "0xdbeE25CbE97e4A5CC6c499875774dc7067E9426B" + "homeRPC": { + "URL": "http://parity1:8545", + "ID": "77" }, - "homeRPCURL": "http://parity1:8545", - "foreignRPCURL": "http://parity2:8545" + "foreignRPC": { + "URL": "http://parity2:8545", + "ID": "42" + } } diff --git a/oracle-e2e/test/ercToErc.js b/oracle-e2e/test/ercToErc.js index 40129fa1..d9c7ce2e 100644 --- a/oracle-e2e/test/ercToErc.js +++ b/oracle-e2e/test/ercToErc.js @@ -2,14 +2,14 @@ const path = require('path') const Web3 = require('web3') const assert = require('assert') const promiseRetry = require('promise-retry') -const { user, ercToErcBridge, homeRPCURL, foreignRPCURL } = require('../../e2e-commons/constants.json') +const { user, ercToErcBridge, homeRPC, foreignRPC } = require('../../e2e-commons/constants.json') const { contractsPath } = require('../config.json') const { generateNewBlock } = require('../../e2e-commons/utils') const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts') -const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPCURL)) -const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPCURL)) +const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL)) +const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL)) const HOME_BRIDGE_ADDRESS = ercToErcBridge.home const FOREIGN_BRIDGE_ADDRESS = ercToErcBridge.foreign diff --git a/oracle-e2e/test/ercToNative.js b/oracle-e2e/test/ercToNative.js index 298b198b..9ac4a1e1 100644 --- a/oracle-e2e/test/ercToNative.js +++ b/oracle-e2e/test/ercToNative.js @@ -2,14 +2,14 @@ const path = require('path') const Web3 = require('web3') const assert = require('assert') const promiseRetry = require('promise-retry') -const { user, ercToNativeBridge, homeRPCURL, foreignRPCURL } = require('../../e2e-commons/constants.json') +const { user, ercToNativeBridge, homeRPC, foreignRPC } = require('../../e2e-commons/constants.json') const { contractsPath } = require('../config.json') const { generateNewBlock } = require('../../e2e-commons/utils') const abisDir = path.join(__dirname, '..', contractsPath, 'build/contracts') -const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPCURL)) -const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPCURL)) +const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL)) +const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL)) const HOME_BRIDGE_ADDRESS = ercToNativeBridge.home const FOREIGN_BRIDGE_ADDRESS = ercToNativeBridge.foreign diff --git a/oracle-e2e/test/nativeToErc.js b/oracle-e2e/test/nativeToErc.js index a1527dce..a29eb5ef 100644 --- a/oracle-e2e/test/nativeToErc.js +++ b/oracle-e2e/test/nativeToErc.js @@ -2,20 +2,18 @@ const path = require('path') const Web3 = require('web3') const assert = require('assert') const promiseRetry = require('promise-retry') -const { user, validator, nativeToErcBridge, secondUser, homeRPCURL, foreignRPCURL } = require('../../e2e-commons/constants.json') +const { user, validator, nativeToErcBridge, secondUser, homeRPC, foreignRPC } = require('../../e2e-commons/constants.json') const { contractsPath } = require('../config.json') const { generateNewBlock } = require('../../e2e-commons/utils') const abisDir = path.join(__dirname, '..', contractsPath, '/build/contracts') - -const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPCURL)) -const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPCURL)) +const homeWeb3 = new Web3(new Web3.providers.HttpProvider(homeRPC.URL)) +const foreignWeb3 = new Web3(new Web3.providers.HttpProvider(foreignRPC.URL)) +const { toBN } = foreignWeb3.utils const HOME_BRIDGE_ADDRESS = nativeToErcBridge.home const FOREIGN_BRIDGE_ADDRESS = nativeToErcBridge.foreign -const { toBN } = foreignWeb3.utils - homeWeb3.eth.accounts.wallet.add(user.privateKey) homeWeb3.eth.accounts.wallet.add(validator.privateKey) homeWeb3.eth.accounts.wallet.add(secondUser.privateKey) diff --git a/ui-e2e/MetaMask.js b/ui-e2e/MetaMask.js index d7657f1e..de9a8df6 100644 --- a/ui-e2e/MetaMask.js +++ b/ui-e2e/MetaMask.js @@ -1,7 +1,7 @@ const key = require('selenium-webdriver').Key; const Page = require('./Page.js').Page; const By = require('selenium-webdriver/lib/by').By; -const {homeNetworkID, foreignNetworkID} = require('./config.json') +const {homeRPC, foreignRPC} = require('../e2e-commons/constants.json') const IDMetaMask = "nkbihfbeogaeaoehlefnkodbefgpgknn"; const URL = "chrome-extension://" + IDMetaMask + "//popup.html"; const buttonSubmit = By.className("confirm btn-green"); @@ -127,12 +127,12 @@ class MetaMask extends Page { async addNetwork(provider) { let url; switch (provider) { - case homeNetworkID: { + case homeRPC.ID: { url = "http://localhost:8541"; networks.push(177); break; } - case foreignNetworkID: { + case foreignRPC.ID: { url = "http://localhost:8542"; networks.push(142); break; diff --git a/ui-e2e/Utils.js b/ui-e2e/Utils.js index 25a6ca30..00f17c01 100644 --- a/ui-e2e/Utils.js +++ b/ui-e2e/Utils.js @@ -1,9 +1,6 @@ const webdriver = require('selenium-webdriver'); const chrome = require('selenium-webdriver/chrome'); -const fs = require('fs-extra'); -const {user} = require('../e2e-commons/constants.json') -const config = require('./config.json') -const configFile = './config.json'; +const {user, nativeToErcBridge, ercToErcBridge, ercToNativeBridge, homeRPC, foreignRPC} = require('../e2e-commons/constants.json') class Utils { @@ -11,7 +8,7 @@ class Utils { return { account: user.address, privateKey: user.privateKey, - networkID: config.homeNetworkID + networkID: homeRPC.homeNetworkID } } @@ -19,20 +16,20 @@ class Utils { return { account: user.address, privateKey: user.privateKey, - networkID: config.foreignNetworkID + networkID: foreignRPC.foreignNetworkID } } static async getStartURL() { - return config.startUrl; + return nativeToErcBridge.ui; } static async getErc20StartURL() { - return config.erc20Url; + return ercToErcBridge.ui; } static async getErc20NativeStartURL() { - return config.erc20NativeUrl; + return ercToNativeBridge.ui; } static async startBrowserWithMetamask() { diff --git a/ui-e2e/config.json b/ui-e2e/config.json index 0d43796d..0531d497 100644 --- a/ui-e2e/config.json +++ b/ui-e2e/config.json @@ -1,7 +1,4 @@ { - "startUrl" : "http://localhost:3000", - "erc20Url" : "http://localhost:3001", - "erc20NativeUrl" : "http://localhost:3002", "homeNetworkID": "77", "foreignNetworkID": "42" }