refactor WizardWelcome.js

This commit is contained in:
dennis00010011b 2018-05-01 11:10:01 -07:00
parent c77a25c2dc
commit e23ee2d4d2
3 changed files with 31 additions and 38 deletions

View File

@ -1,5 +1,5 @@
{
"startURL" : "https://5ae0d38fc9659230d752d6bc--architect-coin-64174.netlify.com/",
"startURL" : "https://5ae77248dd6a541cfe9e6055--architect-coin-64174.netlify.com/",
"outputPath":"./results",
"installMetaMask":true

View File

@ -1,13 +1,7 @@
const Logger= require('../entity/Logger.js');
const logger=Logger.logger;
const tempOutputPath=Logger.tempOutputPath;
const logger = require('../entity/Logger.js').logger;
const page =require('./Page.js').Page;
const By = require('selenium-webdriver/lib/by').By;
const page=require('./Page.js');
const webdriver = require('selenium-webdriver'),
chrome = require('selenium-webdriver/chrome'),
firefox = require('selenium-webdriver/firefox'),
by = require('selenium-webdriver/lib/by');
const By=by.By;
const buttonNewCrowdsale=By.className("button button_fill");
const buttonChooseContract=By.className("button button_outline");
@ -17,39 +11,34 @@ class WizardWelcome extends page.Page{
super(driver);
this.URL=URL;
this.name="WizardWelcome page: ";
}
async clickButtonNewCrowdsale(){
logger.info(this.name+"button NewCrowdsale");
await super.clickWithWait(buttonNewCrowdsale);
return await super.clickWithWait(buttonNewCrowdsale);
}
async clickButtonChooseContract(){
logger.info(this.name+"button ChooseContract");
await super.clickWithWait(buttonChooseContract);
}
async open()
{
logger.info(this.name+": ");
await super.open(this.URL);
return await super.getUrl();
return await super.clickWithWait(buttonChooseContract);
}
async isPresentButtonNewCrowdsale(){
async open() {
logger.info(this.name+": open");
await super.open(this.URL);
return await super.getUrl();
}
async isPresentButtonNewCrowdsale() {
return await super.isElementDisplayed(buttonNewCrowdsale);
}
async isPresentButtonChooseContract(){
async isPresentButtonChooseContract() {
return await super.isElementDisplayed(buttonChooseContract);
}
async isPage(){
return await super.isElementDisplayed(buttonNewCrowdsale) && await super.isElementDisplayed(buttonChooseContract);
}
}
module.exports.WizardWelcome=WizardWelcome;

View File

@ -20,6 +20,18 @@ var browserHandles=[];
class Utils {
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;
}
static runGanache(){
logger.info("Run ganache-cli");
return spawn ('ganache-cli');
@ -273,15 +285,7 @@ return q;
}
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;
}
static async zoom(driver,z){