6d1d4bce6b
* Commented out package-lock.json * Moved over changes from https://github.com/poanetwork/bridge-ui/pull/217 * Brought back package-lock.json used in e2e. * Edited postinstall to work for sub-repo npm install * Using local oracle * Moved ui/e2e-script to ui-e2e * Introduced ui-e2e workspace. * Updated paths,. removed bridge dockerfile. * Updated e2e script after extracting. * Introduced ui-e2e into CI * Disabled ui-e2e * Updated readme.
69 lines
1.5 KiB
JavaScript
69 lines
1.5 KiB
JavaScript
const webdriver = require('selenium-webdriver'),
|
|
chrome = require('selenium-webdriver/chrome');
|
|
const fs = require('fs-extra');
|
|
const configFile = './config.json';
|
|
|
|
class Utils {
|
|
|
|
static async getHomeAccount() {
|
|
try {
|
|
let obj = JSON.parse(fs.readFileSync(configFile), "utf8");
|
|
return obj.homeAccount;
|
|
} catch (err) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
static async getForeignAccount() {
|
|
try {
|
|
let obj = JSON.parse(fs.readFileSync(configFile), "utf8");
|
|
return obj.foreignAccount;
|
|
} catch (err) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
static async getStartURL() {
|
|
try {
|
|
let obj = JSON.parse(fs.readFileSync(configFile), "utf8");
|
|
return obj.startUrl;
|
|
} catch (err) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
static async getErc20StartURL() {
|
|
try {
|
|
let obj = JSON.parse(fs.readFileSync(configFile), "utf8");
|
|
return obj.erc20Url;
|
|
} catch (err) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
static async getErc20NativeStartURL() {
|
|
try {
|
|
let obj = JSON.parse(fs.readFileSync(configFile), "utf8");
|
|
return obj.erc20NativeUrl;
|
|
} catch (err) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
static async startBrowserWithMetamask() {
|
|
let source = './MetaMask.crx';
|
|
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 = {
|
|
Utils: Utils
|
|
}
|
|
|