2019-06-04 12:59:31 +03:00
|
|
|
const webdriver = require('selenium-webdriver');
|
|
|
|
const chrome = require('selenium-webdriver/chrome');
|
2019-06-04 15:02:45 +03:00
|
|
|
const {user, nativeToErcBridge, ercToErcBridge, ercToNativeBridge, homeRPC, foreignRPC} = require('../e2e-commons/constants.json')
|
2019-05-09 13:03:18 +03:00
|
|
|
|
|
|
|
class Utils {
|
|
|
|
|
|
|
|
static async getHomeAccount() {
|
2019-06-04 14:30:37 +03:00
|
|
|
return {
|
|
|
|
account: user.address,
|
|
|
|
privateKey: user.privateKey,
|
2019-06-04 15:02:45 +03:00
|
|
|
networkID: homeRPC.homeNetworkID
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static async getForeignAccount() {
|
2019-06-04 14:30:37 +03:00
|
|
|
return {
|
|
|
|
account: user.address,
|
|
|
|
privateKey: user.privateKey,
|
2019-06-04 15:02:45 +03:00
|
|
|
networkID: foreignRPC.foreignNetworkID
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static async getStartURL() {
|
2019-06-04 15:02:45 +03:00
|
|
|
return nativeToErcBridge.ui;
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static async getErc20StartURL() {
|
2019-06-04 15:02:45 +03:00
|
|
|
return ercToErcBridge.ui;
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static async getErc20NativeStartURL() {
|
2019-06-04 15:02:45 +03:00
|
|
|
return ercToNativeBridge.ui;
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static async startBrowserWithMetamask() {
|
2019-05-21 10:41:52 +03:00
|
|
|
let source = './MetaMask.crx';
|
2019-05-09 13:03:18 +03:00
|
|
|
let options = new chrome.Options();
|
|
|
|
await options.addExtensions(source);
|
|
|
|
await options.addArguments('disable-popup-blocking');
|
|
|
|
let driver = await new webdriver.Builder().withCapabilities(options.toCapabilities()).build();
|
|
|
|
await driver.sleep(5000);
|
|
|
|
return driver;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2019-06-04 12:59:31 +03:00
|
|
|
Utils
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|