e2e update for Ceremmony restyling

This commit is contained in:
Victor Baranov 2018-12-18 18:17:34 +03:00
parent 22a64a107b
commit 58c617d3eb
2 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ const webdriver = require('selenium-webdriver'),
firefox = require('selenium-webdriver/firefox'),
by = require('selenium-webdriver/lib/by');
const generateKeysButton = by.By.xpath("//*[@id=\"root\"]/div/section/div/div");
const generateKeysButton = by.By.xpath("//*[@id=\"root\"]/div/section/div/div[1]/button");
let miningKey = {};
let payoutKey = {};
@ -28,7 +28,7 @@ class Ceremony extends page.Page {
async getMiningKey() {
miningKey.address = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"copyMiningKey\"]")), 20000).getAttribute("data-clipboard-text");
miningKey.password = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"miningKeyPass\"]")), 20000).getAttribute("value");
miningKey.password = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"copyMiningPass\"]")), 20000).getAttribute("data-clipboard-text");
let keyObject = await this._getKeyObject("//*[@id=\"miningKeyDownload\"]");
miningKey.privateKey = keythereum.recover(miningKey.password, keyObject).toString("hex");
miningKey.keyObject = keyObject;
@ -37,7 +37,7 @@ class Ceremony extends page.Page {
async getPayoutKey() {
payoutKey.address = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"copyPayoutKey\"]")), 20000).getAttribute("data-clipboard-text");
payoutKey.password = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"payoutKeyPass\"]")), 20000).getAttribute("value");
payoutKey.password = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"copyPayoutPass\"]")), 20000).getAttribute("data-clipboard-text");
let keyObject = await this._getKeyObject("//*[@id=\"payoutKeyDownload\"]");
payoutKey.privateKey = keythereum.recover(payoutKey.password, keyObject).toString("hex");
payoutKey.keyObject = keyObject;
@ -46,7 +46,7 @@ class Ceremony extends page.Page {
async getVotingKey() {
votingKey.address = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"copyVotingKey\"]")), 20000).getAttribute("data-clipboard-text");
votingKey.password = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"votingKeyPass\"]")), 20000).getAttribute("value");
votingKey.password = await this.driver.wait(webdriver.until.elementLocated(by.By.xpath("//*[@id=\"copyVotingPass\"]")), 20000).getAttribute("data-clipboard-text");
let keyObject = await this._getKeyObject("//*[@id=\"votingKeyDownload\"]");
votingKey.privateKey = keythereum.recover(votingKey.password, keyObject).toString("hex");
votingKey.keyObject = keyObject;

View File

@ -11,7 +11,7 @@ function main() {
const addition = `\nconst local = { "KEYS_MANAGER_ADDRESS": "${addresses.KEYS_MANAGER_ADDRESS}" }`
let addressesFromDapp = fs.readFileSync(`${constants.pathToCeremonyDAppRepo}/src/addresses.js`, 'utf8');
let addressesFromDapp = fs.readFileSync(`${constants.pathToCeremonyDAppRepo}/src/utils/addresses.js`, 'utf8');
let lastImport = `import helpers from './helpers'`;
let lines = addressesFromDapp.split('\n');
@ -25,16 +25,16 @@ function main() {
addressesFromDapp = lines.join(`\n`);
addressesFromDapp = addressesFromDapp.replace('resolve({ addresses: json', 'resolve({ addresses: local')
fs.writeFileSync(`${constants.pathToCeremonyDAppRepo}/src/addresses.js`, addressesFromDapp);
fs.writeFileSync(`${constants.pathToCeremonyDAppRepo}/src/utils/addresses.js`, addressesFromDapp);
// Hardcode ABIs into helpers.js
const pathToKeysManagerJSON = `${constants.contractsFolder}/KeysManager.json`;
const keysManagerABI = JSON.stringify(JSON.parse(fs.readFileSync(pathToKeysManagerJSON)).abi).replace(/,/g, ', ');
const dappHelpers = `${constants.pathToCeremonyDAppRepo}/src/helpers.js`;
const dappHelpers = `${constants.pathToCeremonyDAppRepo}/src/utils/helpers.js`;
let dappHelpersContent = fs.readFileSync(dappHelpers, 'utf8');
const abiAddition = `
if (contract == 'KeysManager') return ${keysManagerABI};`;
if (contract === 'KeysManager') return ${keysManagerABI};`;
const lastGetABI = `function getABI(branch, contract) {`;
dappHelpersContent = dappHelpersContent.replace(lastGetABI, lastGetABI + abiAddition);