Dutch add tests for timer status
This commit is contained in:
parent
c63ea36d39
commit
7fcb3d48e2
|
@ -16,7 +16,7 @@ const logger = createLogger({
|
|||
myFormat
|
||||
),
|
||||
transports: [
|
||||
new (winston.transports.Console)(),
|
||||
//new (winston.transports.Console)(),
|
||||
new (winston.transports.File)({filename: tempOutputFile})
|
||||
]
|
||||
});
|
||||
|
|
|
@ -378,6 +378,7 @@ class User {
|
|||
logger.info("Final invest page link: " + crowdsale.url);
|
||||
logger.info("token address: " + crowdsale.executionID);
|
||||
crowdsale.networkID = this.networkID;
|
||||
crowdsale.sort = 'minted';
|
||||
return result && crowdsale.executionID !== "";
|
||||
}
|
||||
|
||||
|
@ -460,16 +461,17 @@ class User {
|
|||
logger.info("token address: " + crowdsale.executionID);
|
||||
crowdsale.networkID = this.networkID;
|
||||
logger.info("crowdsale.networkID " + crowdsale.networkID);
|
||||
|
||||
crowdsale.networkID = this.networkID;
|
||||
crowdsale.sort = 'dutch';
|
||||
return result && crowdsale.executionID !== "";
|
||||
}
|
||||
|
||||
async changeMinCapFromManagePage(tier,value) {
|
||||
async changeMinCapFromManagePage(tier, value) {
|
||||
logger.info("changeMinCapFromManagePage ");
|
||||
let mngPage = new ManagePage(this.driver);
|
||||
let metaMask = new MetaMask(this.driver);
|
||||
return await mngPage.waitUntilLoaderGone()
|
||||
&& await mngPage.fillMinCap(tier,value)
|
||||
&& await mngPage.fillMinCap(tier, value)
|
||||
//&& !await mngPage.isDisplayedWarningMinCap()
|
||||
&& await mngPage.clickButtonSave()
|
||||
&& await metaMask.signTransaction(10)
|
||||
|
|
|
@ -11,13 +11,16 @@ const errorNotice = By.className("css-6bx4c3");
|
|||
const countdownTimer = By.className("timer");
|
||||
const countdownTimerValue = By.className("timer-count");
|
||||
const countdownTimerStatus = By.className("timer-interval");
|
||||
const fieldsHashTitles = By.className("hashes-title");
|
||||
|
||||
const statusTimer = {
|
||||
start: "START",
|
||||
end: "END",
|
||||
finalized: "HAS BEEN",
|
||||
tier1: "TIER 1",
|
||||
tier2: "TIER 2",
|
||||
tier3:"TIER 3"
|
||||
end: "CROWDSALE HAS ENDED",
|
||||
finalized: "HAS BEEN FINALIZED",
|
||||
tier1: "END OF TIER 1",
|
||||
tier2: "END OF TIER 2",
|
||||
tier3: "END OF TIER 3",
|
||||
|
||||
}
|
||||
|
||||
class ContributionPage extends Page {
|
||||
|
@ -29,14 +32,15 @@ class ContributionPage extends Page {
|
|||
this.fieldCurrentAccount;
|
||||
this.name = "Invest page :";
|
||||
this.timer = [];
|
||||
this.fieldMinContribution;
|
||||
}
|
||||
|
||||
async getTimerStatus() {
|
||||
logger.info(this.name + "getTimerStatus ");
|
||||
try {
|
||||
let array = await this.initTimerFields();
|
||||
let result = await super.getTextForElement(array[array.length-1]);
|
||||
logger.info("timer status: "+result);
|
||||
let result = await super.getTextForElement(array[array.length - 1]);
|
||||
logger.info("timer status: " + result);
|
||||
if (result.includes(statusTimer.start)) return statusTimer.start;
|
||||
else if (result.includes(statusTimer.tier1)) return statusTimer.tier1;
|
||||
else if (result.includes(statusTimer.tier2)) return statusTimer.tier2;
|
||||
|
@ -49,6 +53,20 @@ class ContributionPage extends Page {
|
|||
}
|
||||
}
|
||||
|
||||
async isCrowdsaleFinalized() {
|
||||
logger.info(this.name + "isCrowdsaleFinalized ");
|
||||
return (await this.getTimerStatus() === statusTimer.finalized);
|
||||
}
|
||||
|
||||
async isCrowdsaleNotStarted() {
|
||||
logger.info(this.name + "isCrowdsaleNotStarted ");
|
||||
return (await this.getTimerStatus() === statusTimer.start);
|
||||
}
|
||||
|
||||
async isCrowdsaleEnded() {
|
||||
logger.info(this.name + "isCrowdsaleEnded ");
|
||||
return (await this.getTimerStatus() === statusTimer.end);
|
||||
}
|
||||
|
||||
async isCrowdsaleStarted() {
|
||||
logger.info(this.name + "isCrowdsaleStarted ");
|
||||
|
@ -89,6 +107,7 @@ class ContributionPage extends Page {
|
|||
let array = await super.findWithWait(fields);
|
||||
this.fieldCurrentAccount = array[0];
|
||||
this.fieldExecutionID = array[1];
|
||||
this.fieldMinContribution = array[5];
|
||||
return array;
|
||||
}
|
||||
catch (err) {
|
||||
|
@ -176,6 +195,15 @@ class ContributionPage extends Page {
|
|||
await super.getTextForElement(this.fieldCurrentAccount);
|
||||
}
|
||||
|
||||
async getMinContribution() {
|
||||
logger.info(this.name + "getMinContribution ");
|
||||
if (await this.initFields() === null) return false;
|
||||
let result = await super.getTextForElement(this.fieldMinContribution);
|
||||
if (result === 'You are not allowed') return -1;
|
||||
else return (parseFloat(result.split(" ")[0].trim()));
|
||||
|
||||
}
|
||||
|
||||
async waitUntilShowUpErrorNotice(Twaiting) {
|
||||
logger.info(this.name + "waitUntilShowUpErrorNotice ");
|
||||
return super.waitUntilDisplayed(errorNotice, Twaiting);
|
||||
|
|
203
test/e2eDutch.js
203
test/e2eDutch.js
|
@ -75,9 +75,9 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
Investor2.maxCap = e2eWhitelist.tiers[0].whitelist[0].max;
|
||||
Investor2.tokenBalance = 0;
|
||||
|
||||
await Utils.receiveEth(Owner, 10);
|
||||
await Utils.receiveEth(Investor1, 10);
|
||||
await Utils.receiveEth(Investor2, 10);
|
||||
await Utils.receiveEth(Owner, 20);
|
||||
await Utils.receiveEth(Investor1, 20);
|
||||
await Utils.receiveEth(Investor2, 20);
|
||||
logger.info("Roles:");
|
||||
logger.info("Owner = " + Owner.account);
|
||||
logger.info("Owner's balance = :" + await Utils.getBalance(Owner) / 1e18);
|
||||
|
@ -416,7 +416,6 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
});
|
||||
*/
|
||||
//////////////////////// Test SUITE #1 /////////////////////////////
|
||||
|
||||
test.it('Owner can create crowdsale: 1 whitelisted address,duration 5 min',
|
||||
async function () {
|
||||
let owner = Owner;
|
||||
|
@ -425,6 +424,16 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
return await assert.equal(result, true, 'Test FAILED. Crowdsale has not created ');
|
||||
});
|
||||
|
||||
test.it("Contribution page: Countdown timer has correct status: 'TO START OF TIER1 '",
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.isCrowdsaleNotStarted();
|
||||
return await assert.equal(result, true, 'Test FAILED. Countdown timer has incorrect status ');
|
||||
});
|
||||
|
||||
test.it("Invest page: Owner's balance has correct value (totalSupply-supply) ",
|
||||
async function () {
|
||||
balanceEthOwnerBefore = await Utils.getBalance(Owner);
|
||||
|
@ -447,7 +456,6 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
return await assert.equal(result, false, "Test FAILED. Whitelisted investor can buy before the crowdsale started");
|
||||
});
|
||||
|
||||
|
||||
test.it('Manage page: owner is able to add whitelisted address before start of crowdsale',
|
||||
async function () {
|
||||
let owner = Owner;
|
||||
|
@ -459,28 +467,41 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
return await assert.equal(result, true, 'Test FAILED.Owner is NOT able to add whitelisted address before start of crowdsale ');
|
||||
});
|
||||
|
||||
test.it('Invest page: Countdown timer is displayed',
|
||||
test.it('Crowdsale starts as scheduled',
|
||||
async function () {
|
||||
|
||||
let counter = 180;
|
||||
do {
|
||||
startTime = await Utils.getDutchCrowdsaleStartTime(e2eWhitelist);
|
||||
logger.info("wait " + Date.now());
|
||||
logger.info("wait " + startTime);
|
||||
//console.log("Date.now() = " + Date.now());
|
||||
//console.log("startTime = " + startTime);
|
||||
await driver.sleep(1000);
|
||||
|
||||
}
|
||||
while (counter-- > 0 && (Date.now() / 1000 <= startTime));
|
||||
return await assert.equal(counter > 0, true, 'Test FAILED. Tier has not start in time ');
|
||||
});
|
||||
|
||||
test.it("Contribution page: Countdown timer has correct status: 'TO END OF TIER1 '",
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.getTimerStatus();
|
||||
return await assert.notEqual(result, false, 'Test FAILED. Countdown timer are not displayed ');
|
||||
let result = await investPage.isCurrentTier1();
|
||||
return await assert.equal(result, true, 'Test FAILED. Countdown timer has incorrect status ');
|
||||
});
|
||||
|
||||
test.it('Tier starts as scheduled',
|
||||
test.it("Contribution page: minContribution field is 'You are not allowed' for non-whitelisted investors",
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let counter = 180;
|
||||
do {
|
||||
logger.info("wait " + Date.now());
|
||||
await driver.sleep(1000);
|
||||
}
|
||||
while (counter-- > 0 && !await investPage.isCrowdsaleStarted());
|
||||
return await assert.equal(counter > 0, true, 'Test FAILED. Tier has not start in time ');
|
||||
let result = await investPage.getMinContribution();
|
||||
return await assert.equal(result, -1, 'Test FAILED. MinContribution value is incorrect');
|
||||
});
|
||||
test.it('Manage page: owner is able to add whitelisted address after start of crowdsale',
|
||||
async function () {
|
||||
|
@ -489,23 +510,34 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await owner.openManagePage(e2eWhitelist), true, 'Owner can not open manage page');
|
||||
let tierNumber = 1;
|
||||
investor.minCap = e2eWhitelist.tiers[0].supply/10;
|
||||
investor.minCap = e2eWhitelist.tiers[0].supply / 10;
|
||||
investor.maxCap = e2eWhitelist.tiers[0].supply;
|
||||
let result = await owner.addWhitelistTier(tierNumber, investor.account, investor.minCap, investor.maxCap);
|
||||
return await assert.equal(result, true, 'Test FAILED.Owner is NOT able to add whitelisted address after start of crowdsale ');
|
||||
});
|
||||
|
||||
test.it('Whitelisted investor which was added before start can buy amount equal mincap',
|
||||
test.it("Contribution page: minContribution field contains correct minCap value for whitelisted investor",
|
||||
async function () {
|
||||
let investor = Investor2;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.getMinContribution();
|
||||
return await assert.equal(result, investor.minCap, 'Test FAILED. MinContribution value is incorrect ');
|
||||
});
|
||||
|
||||
test.it('Whitelisted investor which was added before start can buy amount equal mincap',
|
||||
async function () {
|
||||
let investor = Investor2;
|
||||
//assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let contribution = investor.minCap;
|
||||
investor.tokenBalance += contribution;
|
||||
let result = await investor.contribute(contribution);
|
||||
return await assert.equal(result, true, 'Test FAILED. Whitelisted investor that was added before start can not buy');
|
||||
});
|
||||
|
||||
test.it('Whitelisted investor which was added after start can buy amount equal mincap',
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
|
@ -574,7 +606,7 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
return await assert.equal(result, true, "Test FAILED.Investor can buy more than assigned max");
|
||||
});
|
||||
|
||||
test.it("Whitelisted investor's#1 balance limited by maxCap",
|
||||
test.it("Whitelisted investor's #1 balance limited by maxCap",
|
||||
async function () {
|
||||
let investor = Investor1;
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
|
@ -588,15 +620,28 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
|
||||
test.it('Crowdsale has finished as scheduled',
|
||||
async function () {
|
||||
let investor = Investor1;
|
||||
await investor.openInvestPage(e2eWhitelist);
|
||||
let counter = 40;
|
||||
let endTime;
|
||||
let counter = 180;
|
||||
do {
|
||||
driver.sleep(5000);
|
||||
endTime = await Utils.getDutchCrowdsaleEndTime(e2eWhitelist);
|
||||
logger.info("wait " + Date.now());
|
||||
logger.info("wait " + endTime);
|
||||
//console.log("Date.now() = " + Date.now());
|
||||
//console.log("endTime = " + endTime);
|
||||
await driver.sleep(1000);
|
||||
}
|
||||
while ((!await investPage.isCrowdsaleTimeOver()) && (counter-- > 0));
|
||||
let result = (counter > 0);
|
||||
return await assert.equal(result, true, "Test FAILED. Crowdsale has not finished in time");
|
||||
while (counter-- > 0 && (Date.now() / 1000 <= endTime));
|
||||
return await assert.equal(counter > 0, true, 'Test FAILED. Crowdsale has not finished in time ');
|
||||
});
|
||||
|
||||
test.it("Contribution page: Countdown timer has correct status: 'CROWDSALE HAS ENDED'",
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.isCrowdsaleEnded();
|
||||
return await assert.equal(result, true, 'Test FAILED. Countdown timer has incorrect status ');
|
||||
});
|
||||
|
||||
test.it('Whitelisted investor is not able to buy if crowdsale finished',
|
||||
|
@ -623,6 +668,15 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
return await assert.equal(result, true, "Test FAILED.'Owner can NOT finalize ");
|
||||
});
|
||||
|
||||
test.it("Contribution page: Countdown timer has correct status: 'HAS BEEN FINALIZED'",
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.isCrowdsaleFinalized();
|
||||
return await assert.equal(result, true, 'Test FAILED. Countdown timer are not displayed ');
|
||||
});
|
||||
test.it('Investor#1 has received correct quantity of tokens after finalization',
|
||||
async function () {
|
||||
|
||||
|
@ -676,6 +730,16 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
return await assert.equal(result, true, 'Test FAILED. Crowdsale has not created ');
|
||||
});
|
||||
|
||||
test.it("Contribution page: Countdown timer has correct status: 'TO START OF TIER1 '",
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.isCrowdsaleNotStarted();
|
||||
return await assert.equal(result, true, 'Test FAILED. Countdown timer has incorrect status ');
|
||||
});
|
||||
|
||||
test.it("Contribution page: Owner's balance has correct value (totalSupply-supply) ",
|
||||
async function () {
|
||||
balanceEthOwnerBefore = await Utils.getBalance(Owner);
|
||||
|
@ -686,14 +750,24 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
let result = (balance.toString() === shouldBe.toString());
|
||||
return await assert.equal(result, true, "Test FAILED. Owner's balance has incorrect value (totalSupply-supply)");
|
||||
});
|
||||
|
||||
test.it("Contribution page: minContribution field contains correct minCap value ",
|
||||
async function () {
|
||||
let investor = Investor1;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eMinCap), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.getMinContribution();
|
||||
//console.log(result);
|
||||
//console.log( e2eMinCap.tiers[0].minCap);
|
||||
return await assert.equal(result, e2eMinCap.tiers[0].minCap, 'Test FAILED. MinContribution value is incorrect ');
|
||||
});
|
||||
test.it('Manage page: owner is able to change minCap before start of crowdsale',
|
||||
async function () {
|
||||
let owner = Owner;
|
||||
let tierNumber = 1;
|
||||
assert.equal(await owner.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await owner.openManagePage(e2eMinCap), true, 'Owner can not open manage page');
|
||||
e2eMinCap.tiers[0].minCap = e2eMinCap.tiers[0].minCap /2;
|
||||
e2eMinCap.tiers[0].minCap = e2eMinCap.tiers[0].minCap / 2;
|
||||
let result = await owner.changeMinCapFromManagePage(tierNumber, e2eMinCap.tiers[0].minCap);
|
||||
return await assert.equal(result, true, 'Test FAILED.Owner is NOT able to add whitelisted address before start of crowdsale ');
|
||||
});
|
||||
|
@ -709,30 +783,44 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
return await assert.equal(result, false, "Test FAILED. Whitelisted investor can buy before the crowdsale started");
|
||||
});
|
||||
|
||||
test.it('Contribution page: Countdown timer is displayed',
|
||||
test.it('Crowdsale starts as scheduled',
|
||||
async function () {
|
||||
let investor = Investor1;
|
||||
await investor.openInvestPage(e2eMinCap);
|
||||
await investPage.waitUntilLoaderGone();
|
||||
let result = await investPage.getTimerStatus();
|
||||
return await assert.notEqual(result, false, 'Test FAILED. Countdown timer are not displayed ');
|
||||
});
|
||||
|
||||
test.it('Tier starts as scheduled',
|
||||
async function () {
|
||||
let investor = Investor1;
|
||||
await investor.openInvestPage(e2eMinCap);
|
||||
await investPage.waitUntilLoaderGone();
|
||||
let counter = 120;
|
||||
let counter = 180;
|
||||
do {
|
||||
startTime = await Utils.getDutchCrowdsaleStartTime(e2eMinCap);
|
||||
logger.info("wait " + Date.now());
|
||||
logger.info("wait " + startTime);
|
||||
//console.log("Date.now() = " + Date.now());
|
||||
//console.log("startTime = " + startTime);
|
||||
await driver.sleep(1000);
|
||||
}
|
||||
while (counter-- > 0 && !await investPage.isCrowdsaleStarted());
|
||||
while (counter-- > 0 && (Date.now() / 1000 <= startTime));
|
||||
return await assert.equal(counter > 0, true, 'Test FAILED. Tier has not start in time ');
|
||||
});
|
||||
|
||||
|
||||
test.it("Contribution page: Countdown timer has correct status: 'TO END OF TIER1 '",
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eMinCap), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.isCurrentTier1();
|
||||
return await assert.equal(result, true, 'Test FAILED. Countdown timer has incorrect status ');
|
||||
});
|
||||
test.it("Contribution page: minContribution field contains correct minCap value (after modifying)",
|
||||
async function () {
|
||||
let investor = Investor1;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eMinCap), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.getMinContribution();
|
||||
// console.log("minContr= "+ result );
|
||||
// console.log("minCap= "+ e2eMinCap.tiers[0].minCap );
|
||||
// console.log("equals= "+ result === e2eMinCap.tiers[0].minCap);
|
||||
// await driver.sleep(30000);
|
||||
return await assert.equal(result, e2eMinCap.tiers[0].minCap, 'Test FAILED. MinContribution value is incorrect ');
|
||||
});
|
||||
test.it('Investor is not able to buy less than minCap in first transaction',
|
||||
async function () {
|
||||
let investor = Investor1;
|
||||
|
@ -782,17 +870,25 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
let tierNumber = 1;
|
||||
assert.equal(await owner.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await owner.openManagePage(e2eMinCap), true, 'Owner can not open manage page');
|
||||
e2eMinCap.tiers[0].minCap = e2eMinCap.tiers[0].minCap *2;
|
||||
e2eMinCap.tiers[0].minCap = e2eMinCap.tiers[0].minCap * 2;
|
||||
let result = await owner.changeMinCapFromManagePage(tierNumber, e2eMinCap.tiers[0].minCap);
|
||||
return await assert.equal(result, true, 'Test FAILED.Manage page: owner is not able to update minCap after start of crowdsale ');
|
||||
});
|
||||
|
||||
test.it('minCap should be updated: new investor is not able to buy less than new minCap ',
|
||||
test.it("Contribution page: minContribution field contains correct minCap value (after modifying) ",
|
||||
async function () {
|
||||
let investor = Investor2;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eMinCap), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.getMinContribution();
|
||||
return await assert.equal(result, e2eMinCap.tiers[0].minCap, 'Test FAILED. MinContribution value is incorrect ');
|
||||
});
|
||||
test.it('minCap should be updated: new investor is not able to buy less than new minCap ',
|
||||
async function () {
|
||||
let investor = Investor2;
|
||||
//assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eMinCap), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let contribution = e2eMinCap.tiers[0].minCap - 1;
|
||||
let result = await investor.contribute(contribution);
|
||||
return await assert.equal(result, false, "Test FAILED. minCap wasn't updated");
|
||||
|
@ -815,16 +911,15 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eMinCap), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let contribution = e2eMinCap.tiers[0].minCap/10;
|
||||
let contribution = e2eMinCap.tiers[0].minCap / 10;
|
||||
investor.tokenBalance += contribution;
|
||||
console.log ("investor.tokenBalance= "+investor.tokenBalance)
|
||||
|
||||
await investor.contribute(contribution);
|
||||
let balance = await investor.getBalanceFromInvestPage(e2eMinCap);
|
||||
let result = (Math.abs(parseFloat(balance) - parseFloat(investor.tokenBalance)) < 1);
|
||||
return await assert.equal(result, true, "Test FAILED.Investor can not buy maxCap");
|
||||
});
|
||||
|
||||
|
||||
test.it('Investor is able to buy maxCap',
|
||||
async function () {
|
||||
let investor = Investor1;
|
||||
|
@ -855,6 +950,16 @@ test.describe('e2e test for TokenWizard2.0/DutchAuctionCrowdsale. v2.7.0 ', asyn
|
|||
return await assert.equal(result, true, "Test FAILED.'Owner can NOT finalize ");
|
||||
});
|
||||
|
||||
test.it("Contribution page: Countdown timer has correct status: 'HAS BEEN FINALIZED '",
|
||||
async function () {
|
||||
let investor = Owner;
|
||||
assert.equal(await investor.setMetaMaskAccount(), true, "Can not set Metamask account");
|
||||
assert.equal(await investor.openInvestPage(e2eWhitelist), true, 'Investor can not open Invest page');
|
||||
assert.equal(await investPage.waitUntilLoaderGone(), true, 'Loader displayed too long time');
|
||||
let result = await investPage.isCrowdsaleFinalized();
|
||||
return await assert.equal(result, true, 'Test FAILED. Countdown timer has incorrect status ');
|
||||
});
|
||||
|
||||
test.it('Investor #1 has received correct quantity of tokens after finalization',
|
||||
async function () {
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class Utils {
|
|||
let provider = await Utils.getProviderUrl(user.networkID);
|
||||
let web3 = await new Web3(new Web3.providers.HttpProvider(provider));
|
||||
let account0 = await web3.eth.getAccounts().then((accounts) => {
|
||||
return accounts[2];
|
||||
return accounts[3];
|
||||
});
|
||||
|
||||
logger.info("Send " + amount + " Eth from " + account0 + " to " + user.account);
|
||||
|
@ -443,6 +443,30 @@ class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static async getDutchCrowdsaleStartTime(crowdsale) {
|
||||
logger.info("getDutchCrowdsaleStartTime");
|
||||
if(crowdsale.sort === _minted) return false;
|
||||
let web3 = Utils.getWeb3Instance(crowdsale.networkID);
|
||||
const abi = await Utils.getContractABIInitCrowdsale(crowdsale);
|
||||
let myContract = new web3.eth.Contract(abi, await Utils.getEnvAddressDutchIDXAddress());
|
||||
let result = await myContract.methods.getCrowdsaleStartAndEndTimes(await Utils.getEnvAddressAbstractStorage(), crowdsale.executionID).call();
|
||||
return result.start_time;
|
||||
}
|
||||
|
||||
static async getDutchCrowdsaleEndTime(crowdsale) {
|
||||
logger.info("getDutchCrowdsaleEndTime");
|
||||
if(crowdsale.sort === _minted) return false;
|
||||
let web3 = Utils.getWeb3Instance(crowdsale.networkID);
|
||||
const abi = await Utils.getContractABIInitCrowdsale(crowdsale);
|
||||
let myContract = new web3.eth.Contract(abi, await Utils.getEnvAddressDutchIDXAddress());
|
||||
let result = await myContract.methods.getCrowdsaleStartAndEndTimes(await Utils.getEnvAddressAbstractStorage(), crowdsale.executionID).call();
|
||||
return result.end_time;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static async getCrowdsaleStatusRopsten(crowdsale,abi) {
|
||||
//console.log("getCrowdsaleStatusRopsten");
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue