2019-07-02 16:12:57 +03:00
|
|
|
const webdriver = require('selenium-webdriver')
|
|
|
|
const chrome = require('selenium-webdriver/chrome')
|
|
|
|
const {
|
|
|
|
user,
|
|
|
|
nativeToErcBridge,
|
|
|
|
ercToErcBridge,
|
|
|
|
ercToNativeBridge,
|
2020-06-01 20:58:03 +03:00
|
|
|
ambStakeErcToErc,
|
2019-07-02 16:12:57 +03:00
|
|
|
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:15:14 +03:00
|
|
|
networkID: homeRPC.ID
|
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:15:14 +03:00
|
|
|
networkID: foreignRPC.ID
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static async getStartURL() {
|
2019-07-02 16:12:57 +03:00
|
|
|
return nativeToErcBridge.ui
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static async getErc20StartURL() {
|
2019-07-02 16:12:57 +03:00
|
|
|
return ercToErcBridge.ui
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static async getErc20NativeStartURL() {
|
2019-07-02 16:12:57 +03:00
|
|
|
return ercToNativeBridge.ui
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
|
2020-06-01 20:58:03 +03:00
|
|
|
static async getAMBStakeStartURL() {
|
|
|
|
return ambStakeErcToErc.ui
|
|
|
|
}
|
|
|
|
|
2019-05-09 13:03:18 +03:00
|
|
|
static async startBrowserWithMetamask() {
|
2019-07-02 16:12:57 +03:00
|
|
|
const source = './MetaMask.crx'
|
|
|
|
const options = new chrome.Options()
|
2020-09-02 17:43:48 +03:00
|
|
|
await options.addArguments('--no-sandbox')
|
|
|
|
await options.addArguments('--disable-gpu')
|
|
|
|
await options.addArguments('--disable-dev-shm-usage')
|
2019-07-02 16:12:57 +03:00
|
|
|
await options.addArguments('disable-popup-blocking')
|
2020-09-02 17:43:48 +03:00
|
|
|
await options.addExtensions(source)
|
2019-07-02 16:12:57 +03:00
|
|
|
const driver = await new webdriver.Builder().withCapabilities(options.toCapabilities()).build()
|
|
|
|
await driver.sleep(5000)
|
|
|
|
return driver
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2019-06-04 12:59:31 +03:00
|
|
|
Utils
|
2019-05-09 13:03:18 +03:00
|
|
|
}
|