tokenbridge/ui-e2e/Utils.js

63 lines
1.4 KiB
JavaScript
Raw Normal View History

const webdriver = require('selenium-webdriver')
const chrome = require('selenium-webdriver/chrome')
const {
user,
nativeToErcBridge,
ercToErcBridge,
ercToNativeBridge,
ambStakeErcToErc,
homeRPC,
foreignRPC
} = require('../e2e-commons/constants.json')
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
}
}
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
}
}
static async getStartURL() {
return nativeToErcBridge.ui
}
static async getErc20StartURL() {
return ercToErcBridge.ui
}
static async getErc20NativeStartURL() {
return ercToNativeBridge.ui
}
static async getAMBStakeStartURL() {
return ambStakeErcToErc.ui
}
static async startBrowserWithMetamask() {
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')
await options.addArguments('disable-popup-blocking')
2020-09-02 17:43:48 +03:00
await options.addExtensions(source)
const 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
}