update Metamask 4.8.0

This commit is contained in:
dennis00010011b 2018-06-22 10:23:10 -07:00
parent 265c53ad45
commit eb81429201
21 changed files with 138 additions and 98 deletions

Binary file not shown.

BIN
MetaMask_4_8_0_0.crx Normal file

Binary file not shown.

View File

@ -196,12 +196,4 @@ Test suite for DutchAuctionCrowdsale , starts with command ```npm run e2eDutch``
- Investor has received correct quantity of tokens after finalization
- Owner has received correct quantity of tokens after finalization
```

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@ class Crowdsale {
this.walletAddress;
this.reservedTokens = [];
this.gasPrice;
this.minCap;
this.tiers = [];
this.tokenAddress;
@ -31,7 +31,6 @@ class Crowdsale {
this.reservedTokens = obj.reservedTokens;
this.walletAddress = obj.walletAddress;
this.gasPrice = obj.gasprice;
this.minCap = obj.mincap;
this.tiers = obj.tiers;
}
@ -51,7 +50,6 @@ class Crowdsale {
logger.info("walletAddress:" + this.walletAddress);
logger.info("gasprice:" + this.gasPrice);
logger.info("mincap:" + this.minCap);
logger.info("number of tiers:" + this.tiers.length);
for (let i = 0; i < this.tiers.length; i++) {
@ -63,6 +61,7 @@ class Crowdsale {
logger.info("startTime:" + this.tiers[i].startTime);
logger.info("endDate:" + this.tiers[i].endDate);
logger.info("endTime:" + this.tiers[i].endTime);
logger.info("mincap:" + this.minCap);
logger.info("rate:" + this.tiers[i].rate);
logger.info("supply:" + this.tiers[i].supply);
logger.info("Whitelist length: " + this.tiers[i].whitelist.length);

View File

@ -16,7 +16,7 @@ const logger = createLogger({
myFormat
),
transports: [
//new (winston.transports.Console)(),
new (winston.transports.Console)(),
new (winston.transports.File)({filename: tempOutputFile})
]
});

View File

@ -1,5 +1,5 @@
class Tier {
constructor(name, isWhitelisted, allowModify, rate, supply, startTime, startDate, endTime, endDate, whitelist) {
constructor(name, isWhitelisted, allowModify, rate, supply, startTime, startDate, endTime, endDate, whitelist,minCap) {
this.name = name;
this.isWhitelisted = isWhitelisted;
this.allowModify = allowModify;
@ -12,8 +12,8 @@ class Tier {
this.whitelist = whitelist;
this.minRate = undefined;
this.maxRate = undefined;
this.minCap = minCap;
}
}
module.exports.Tier = Tier;

View File

@ -337,6 +337,7 @@ class User {
await reservedTokens.fillReservedTokens(crowdsale) &&
await wizardStep2.clickButtonContinue() &&
await wizardStep3.fillPage(crowdsale);
counter = 200;
do {
await this.driver.sleep(300);
@ -414,6 +415,7 @@ class User {
await wizardStep2.fillPage(crowdsale) &&
await wizardStep2.clickButtonContinue() &&
await wizardStep3.fillPage(crowdsale);
if (!result) return false;
counter = 200;
do {

View File

@ -5,7 +5,8 @@ const By = require('selenium-webdriver/lib/by').By;
const IDMetaMask = "nkbihfbeogaeaoehlefnkodbefgpgknn";
const URL = "chrome-extension://" + IDMetaMask + "//popup.html";
const buttonSubmit = By.className("confirm btn-green");
const buttonAccept = By.xpath('//*[@id="app-content"]/div/div[4]/div/button');
const buttonAccept = By.xpath('//*[@id="app-content"]/div/div[4]/div/div[1]/button');
//const buttonAccept = By.xpath("//*[contains(text(),'Accept')]");
const agreement = By.xpath("//*[@id=\"app-content\"]/div/div[4]/div/div/div/p[1]/strong");
const fieldNewPass = By.xpath("//*[@id=\"password-box\"]");
const fieldConfirmPass = By.xpath("//*[@id=\"password-box-confirm\"]");
@ -15,7 +16,8 @@ const popupNetwork = By.className("network-name");
const popupAccount = By.xpath("//*[@id=\"app-content\"]/div/div[1]/div/div[2]/span/div");
const fieldPrivateKey = By.xpath("//*[@id=\"private-key-box\"]");
const pass = "qwerty12345";
const buttonImport = By.xpath("//*[@id=\"app-content\"]/div/div[4]/div/div[3]/button");
const buttonImport = By.xpath("//*[@id=\"app-content\"]/div/div[4]/div/div[4]/button");
const fieldNewRPCURL = By.id("new_rpc");
const buttonSave = By.xpath("//*[@id=\"app-content\"]/div/div[4]/div/div[3]/div/div[2]/button");
const arrowBackRPCURL = By.xpath("//*[@id=\"app-content\"]/div/div[4]/div/div[1]/i");
@ -43,10 +45,15 @@ class MetaMask extends Page {
logger.info(this.name + "activate ");
return await this.switchToNextPage() &&
await this.open(this.URL) &&
await this.clickWithWait(buttonAccept) &&
await this.clickWithWait(agreement) &&
//await this.clickWithWait(buttonAccept) &&
//await this.clickWithWait(agreement) &&
await this.pressKey(key.TAB, 15) &&
await this.clickWithWait(buttonAccept) &&
//await this.clickWithWait(agreement) &&
await this.pressKey(key.TAB, 3) &&
await this.clickWithWait(buttonAccept) &&
await this.pressKey(key.TAB, 3) &&
await this.clickWithWait(buttonAccept) &&
await this.waitUntilLocated(fieldNewPass) &&
await this.clickWithWait(fieldNewPass) &&
await this.fillWithWait(fieldNewPass, pass) &&

View File

@ -78,6 +78,20 @@ class TierPage extends Page {
await super.fillWithWait(element, this.tier.rate);
}
async getFieldMinCap() {
logger.info(this.name + "getFieldMinCap ");
const locator = By.id("tiers[" + this.number + "].minCap");
return await super.getElement(locator);
}
async fillMinCap() {
logger.info(this.name + "fillMinCap ");
if (this.tier.minCap === undefined) return true;
let element = await this.getFieldMinCap();
return await super.clearField(element) &&
await super.fillWithWait(element, this.tier.minCap);
}
async getFieldSupply() {
logger.info(this.name + "getFieldSupply ");
const locator = By.id("tiers[" + this.number + "].supply");
@ -171,7 +185,7 @@ class TierPage extends Page {
}
async initWhitelistFields() {
logger.info(this.name + "initWhitelistContainer ");
logger.info(this.name + "initWhitelistFields ");
try {
let element = (await this.findWithWait(whitelistContainer))[this.number];
let array = await this.getChildFromElementByClassName("input", element);
@ -406,6 +420,7 @@ class TierPage extends Page {
async fillTier() {
logger.info(this.name + "fillTier ");
return await this.setModify()
&& await this.fillMinCap()
&& await this.setWhitelisting()
&& await this.fillMinRate()
&& await this.fillMaxRate()
@ -426,7 +441,9 @@ class TierPage extends Page {
async fillWhitelist() {
logger.info(this.name + "fillWhitelist ");
try {
for (let i = 0; i < this.tier.whitelist.length; i++) {
logger.info(this.name + "fillWhitelist #" + i + ": ");
do {

View File

@ -204,8 +204,7 @@ class WizardStep3 extends Page {
logger.info(this.name + "fillPage ");
let result = await this.waitUntilLoaderGone() &&
await this.fillWalletAddress(crowdsale.walletAddress) &&
await this.setGasPrice(crowdsale.gasPrice) &&
await this.fillMinCap(crowdsale.minCap);
await this.setGasPrice(crowdsale.gasPrice);
for (let i = 0; i < crowdsale.tiers.length - 1; i++) {
result = await new TierPage(this.driver, crowdsale.tiers[i]).fillTier()

View File

@ -4,7 +4,7 @@
"ticker": "test",
"decimals": 18,
"totalSupply":12345,
"totalSupply":10000,
"walletAddress":"0x0e036E74F31aDDb9e0ADcB80dEA9Ed1E187DFe50",
"gasprice":160,
@ -14,8 +14,8 @@
"isWhitelisted":false,
"startDate": "240000",
"startTime": "240000",
"endDate":"360000",
"endTime":"360000",
"endDate":"2040000",
"endTime":"2040000",
"minRate":100,
"maxRate":1000,
"supply": 1000,

View File

@ -2,23 +2,22 @@
"name": "scenarioDutchRopsten.json",
"ticker": "test",
"decimals": 18,
"totalSupply":12345,
"walletAddress":"0x0e036E74F31aDDb9e0ADcB80dEA9Ed1E187DFe50",
"decimals": 10,
"totalSupply":10000,
"walletAddress":"0x56B2e3C3cFf7f3921Dc2e0F8B8e20d1eEc29216b",
"gasprice":160,
"tiers":[
{
"allowModify": false,
"isWhitelisted":true,
"startDate": "",
"startTime": "",
"endDate":"360000",
"endTime":"360000",
"minRate":1750,
"maxRate":3500,
"supply": 1000,
"isWhitelisted":false,
"startDate": "420000",
"startTime": "420000",
"endDate":"960000",
"endTime":"960000",
"minCap":31,
"minRate":100,
"maxRate":1000,
"supply": 100,
"whitelist":[
{
"address": "0xF16AB2EA0a7F7B28C267cbA3Ed211Ea5c6e27411",
@ -27,8 +26,8 @@
},
{
"address": "0x9E963042D581D262AdE4E31541360e7FDAeE70C6",
"min": 0,
"max": 1000
"min": 50,
"max": 150
}
]
}]

View File

@ -1,34 +1,25 @@
{
"name": "scenarioE2eMintedWhitelist",
"name": "scenarioMintedRopsten",
"ticker": "test",
"decimals": 18,
"reservedTokens":[
{
"address" :"0xecDFec71AbCD5a612eAf9169B19E907eAA2717d9",
"dimension": "percentage",
"value": 250
},
{
"address" : "0x56B2e3C3cFf7f3921Dc2e0F8B8e20d1eEc29216b",
"dimension": "tokens",
"value":100000000
}
"reservedTokens": [
],
"walletAddress":"0x56B2e3C3cFf7f3921Dc2e0F8B8e20d1eEc29216b",
"walletAddress": "0x56B2e3C3cFf7f3921Dc2e0F8B8e20d1eEc29216b",
"gasprice": 100,
"mincap": 1,
"tiers":[
"tiers": [
{
"name":"###1",
"allowModify": true,
"isWhitelisted":true,
"name": "###1",
"allowModify": false,
"isWhitelisted": true,
"startDate": "420000",
"startTime": "420000",
"endDate":"500000",
"endTime":"500000",
"rate":20000,
"supply": 250,
"whitelist":[
"endDate": "1200000",
"endTime": "1200000",
"minCap":45,
"rate": 1000,
"supply": 200,
"whitelist": [
{
"address": "0xF16AB2EA0a7F7B28C267cbA3Ed211Ea5c6e27411",
"min": 50,
@ -40,20 +31,61 @@
"max": 150
}
]
},
{
"name":"###2",
"allowModify": true,
"isWhitelisted":true,
"name": "###2",
"allowModify": false,
"isWhitelisted": true,
"startDate": "",
"startTime": "",
"endDate":"",
"endTime":"",
"rate":10000,
"endDate": "",
"endTime": "",
"minCap":45,
"rate": 1000,
"supply": 200,
"whitelist":[
"whitelist": [
{
"address": "0xdDdC96314b7f16cB243Cb07e1dE081CA367095E7",
"min": 25,
"max": 250
}]}]}
"address": "0xF16AB2EA0a7F7B28C267cbA3Ed211Ea5c6e27411",
"min": 12,
"max": 123
},
{
"address": "0x9E963042D581D262AdE4E31541360e7FDAeE70C6",
"min": 50,
"max": 150
}
]
},
{
"name": "###3",
"allowModify": false,
"isWhitelisted": true,
"startDate": "",
"startTime": "",
"endDate": "",
"endTime": "",
"minCap":45,
"rate": 1000,
"supply": 200,
"whitelist": [
{
"address": "0xF16AB2EA0a7F7B28C267cbA3Ed211Ea5c6e27411",
"min": 12,
"max": 123
},
{
"address": "0x9E963042D581D262AdE4E31541360e7FDAeE70C6",
"min": 50,
"max": 150
}
]
}
]
}

View File

@ -74,6 +74,7 @@ test.describe('POA token-wizard. Test DutchAuction Ropsten', async function () {
startURL = await Utils.getStartURL();
driver = await Utils.startBrowserWithMetamask();
Owner = new User(driver, user3_56B2File);

View File

@ -67,17 +67,10 @@ test.describe('POA token-wizard. Test MintedCappedCrowdsale', async function ()
const scenarioRopsten = './scenarios/scenarioMintedRopsten.json';
e2eRopsten = await Utils.getMintedCrowdsaleInstance(scenarioRopsten);
startURL = await Utils.getStartURL();
driver = await Utils.startBrowserWithMetamask();
Owner = new User(driver, user3_56B2File);
metaMask = new MetaMask(driver);
await metaMask.activate();//return activated Metamask and empty page
await Owner.setMetaMaskAccount();

View File

@ -102,6 +102,7 @@ test.describe('POA token-wizard. Test DutchAuction Ropsten', async function () {
});
//////////////////////// Test SUITE #1 /////////////////////////////
test.it('ceate crowdsale, duration 5 min',
async function () {
let owner = Owner;
@ -114,7 +115,7 @@ test.describe('POA token-wizard. Test DutchAuction Ropsten', async function () {
let investor = Owner;
assert.equal(await investor.openInvestPage(e2eRopsten), true, 'Investor can not open Invest page');
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
let counter = 180;
let counter = 1080;
do {
logger.info("wait " + Date.now());
await driver.sleep(1000);

View File

@ -17,7 +17,7 @@ async function run() {
let crowdsale = new Crowdsale();
crowdsale.executionID = '0x8d96e757b5e5b2a533b7b1ad17493245ac729e6b78bf4e4e81bd8098b50a797a';
crowdsale.sort = "dutch";
let file = await takeFunctionRateTime(crowdsale);
let file = await Utils.takeFunctionRateTime(crowdsale);
//console.log("Status = " + JSON.stringify(status));
//console.log("Status.current_rate = " + status.current_rate);

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
[{"time":"0","rate":"10000000000000000"},{"time":"1","rate":"10000000000000000"},{"time":"2","rate":"10000000000000000"},{"time":"3","rate":"10000000000000000"},{"time":"4","rate":"10000000000000000"},{"time":"5","rate":"10000000000000000"},{"time":"6","rate":"10000000000000000"},{"time":"7","rate":"10000000000000000"},{"time":"8","rate":"10000000000000000"},{"time":"9","rate":"10000000000000000"},{"time":"10","rate":"10000000000000000"},{"time":"11","rate":"10000000000000000"},{"time":"12","rate":"10000000000000000"},{"time":"13","rate":"10000000000000000"},{"time":"14","rate":"10000000000000000"},{"time":"15","rate":"10000000000000000"},{"time":"16","rate":"10000000000000000"},{"time":"17","rate":"10000000000000000"},{"time":"18","rate":"10000000000000000"},{"time":"19","rate":"10000000000000000"},{"time":"20","rate":"10000000000000000"},{"time":"21","rate":"10000000000000000"},{"time":"22","rate":"10000000000000000"},{"time":"23","rate":"10000000000000000"},{"time":"24","rate":"10000000000000000"},{"time":"25","rate":"10000000000000000"},{"time":"26","rate":"10000000000000000"},{"time":"27","rate":"10000000000000000"},{"time":"28","rate":"10000000000000000"},{"time":"29","rate":"10000000000000000"},{"time":"30","rate":"10000000000000000"},{"time":"31","rate":"10000000000000000"},{"time":"32","rate":"10000000000000000"},{"time":"33","rate":"10000000000000000"},{"time":"34","rate":"10000000000000000"},{"time":"35","rate":"10000000000000000"},{"time":"36","rate":"10000000000000000"},{"time":"37","rate":"10000000000000000"},{"time":"38","rate":"10000000000000000"},{"time":"39","rate":"10000000000000000"},{"time":"40","rate":"10000000000000000"},{"time":"41","rate":"10000000000000000"},{"time":"42","rate":"10000000000000000"},{"time":"43","rate":"10000000000000000"},{"time":"44","rate":"10000000000000000"},{"time":"45","rate":"10000000000000000"},{"time":"46","rate":"10000000000000000"},{"time":"47","rate":"10000000000000000"},{"time":"48","rate":"10000000000000000"},{"time":"49","rate":"10000000000000000"},{"time":"50","rate":"10000000000000000"},{"time":"51","rate":"10000000000000000"},{"time":"52","rate":"10000000000000000"},{"time":"53","rate":"10000000000000000"},{"time":"54","rate":"10000000000000000"},{"time":"55","rate":"10000000000000000"},{"time":"56","rate":"10000000000000000"},{"time":"57","rate":"10000000000000000"},{"time":"58","rate":"10000000000000000"},{"time":"59","rate":"10000000000000000"},{"time":"60","rate":"10000000000000000"},{"time":"61","rate":"10000000000000000"},{"time":"62","rate":"10000000000000000"},{"time":"63","rate":"10000000000000000"},{"time":"64","rate":"10000000000000000"},{"time":"65","rate":"10000000000000000"},{"time":"66","rate":"6700000000000000"},{"time":"67","rate":"3850000000000000"},{"time":"68","rate":"3850000000000000"},{"time":"69","rate":"3850000000000000"},{"time":"70","rate":"3850000000000000"},{"time":"71","rate":"3850000000000000"},{"time":"72","rate":"3850000000000000"},{"time":"73","rate":"3625000000000000"},{"time":"74","rate":"3625000000000000"},{"time":"75","rate":"3625000000000000"},{"time":"76","rate":"3625000000000000"},{"time":"77","rate":"3625000000000000"},{"time":"78","rate":"3625000000000000"},{"time":"79","rate":"3625000000000000"},{"time":"80","rate":"3625000000000000"},{"time":"81","rate":"3625000000000000"},{"time":"82","rate":"3625000000000000"},{"time":"83","rate":"3625000000000000"},{"time":"84","rate":"3625000000000000"},{"time":"85","rate":"3625000000000000"},{"time":"86","rate":"3625000000000000"},{"time":"87","rate":"3625000000000000"},{"time":"88","rate":"3625000000000000"},{"time":"89","rate":"3625000000000000"},{"time":"90","rate":"3625000000000000"},{"time":"91","rate":"3625000000000000"},{"time":"92","rate":"3025000000000000"},{"time":"93","rate":"3025000000000000"},{"time":"94","rate":"3025000000000000"},{"time":"95","rate":"0"}]

View File

@ -15,7 +15,8 @@ const _dutch = 'dutch';
class Utils {
static async startBrowserWithMetamask() {
let source = './MetaMask.crx';
logger.info("Utils: startBrowserWithMetamask");
let source = './MetaMask_4_8_0_0.crx';//./MetaMask.crx';
let options = new chrome.Options();
await options.addExtensions(source);
await options.addArguments('disable-popup-blocking');
@ -404,9 +405,11 @@ class Utils {
await fs.ensureDirSync("./time_rate_logs/");
let file = "./time_rate_logs/time_rate" + Date.now() + ".json";
let fileLog = "./time_rate_logs/time_rate" + Date.now() + ".log";
let duration = parseInt(crowdsale.tiers[0].endTime)-parseInt(crowdsale.tiers[0].startTime);
await fs.writeFileSync(fileLog, "duration = " +duration/60000 + "min \n");
await fs.appendFileSync(fileLog,"execID = " +crowdsale.executionID);
await fs.writeFileSync(fileLog,"startTime "+crowdsale.tiers[0].startTime+"\n");
await fs.appendFileSync(fileLog, "endTime "+crowdsale.tiers[0].endTime+"\n");
await fs.appendFileSync(fileLog,"timestamp = " +Date.now() + "\n");
await fs.appendFileSync(fileLog,"execID = " +crowdsale.executionID + "\n");
await fs.appendFileSync(fileLog, "minRate = " + crowdsale.tiers[0].minRate + "\n");
await fs.appendFileSync(fileLog, "maxRate = " + crowdsale.tiers[0].maxRate + "\n");
@ -429,7 +432,7 @@ class Utils {
}
while ((parseInt(status.time_remaining) !== 0));
await fs.appendJsonSync(file, array);
await fs.writeJsonSync(file, array);
await fs.appendFileSync(fileLog, arrayLog);
return file;
@ -441,15 +444,15 @@ class Utils {
}
static async getCrowdsaleStatusRopsten(crowdsale,abi) {
console.log("getCrowdsaleStatusRopsten");
//console.log("getCrowdsaleStatusRopsten");
try {
let networkIDRopsten = 3;
const web3 = await Utils.getWeb3Instance(networkIDRopsten);
let REACT_APP_REGISTRY_STORAGE_ADDRESS = "0xb1d914e7c55f16c2bacac11af6b3e011aee38caf";
let REACT_APP_DUTCH_CROWDSALE_INIT_CROWDSALE_ADDRESS = "0xbe9c4888a51761f6c5a7d3803106edab7c96196e";
let REACT_APP_REGISTRY_STORAGE_ADDRESS = "0x9996020c8864964688411b3d90ac27eb5b0937c7";
let REACT_APP_DUTCH_CROWDSALE_INIT_CROWDSALE_ADDRESS = "0xdcD30b8417062AbDFAd1db173D66bd6e0D31929E";
let myContract = new web3.eth.Contract(abi, REACT_APP_DUTCH_CROWDSALE_INIT_CROWDSALE_ADDRESS);
let status = await myContract.methods.getCrowdsaleStatus(REACT_APP_REGISTRY_STORAGE_ADDRESS, crowdsale.executionID).call();
//console.log("status = " + status );
console.log("status = " + status );
return status;
}
catch (err) {