UI tests for Step2
This commit is contained in:
parent
848030bcdd
commit
4788564868
|
@ -423,24 +423,34 @@ class User {
|
|||
await welcomePage.open();
|
||||
|
||||
await welcomePage.clickButtonNewCrowdsale();
|
||||
let count=10;
|
||||
let count=30;
|
||||
do {
|
||||
await this.driver.sleep(1000);
|
||||
|
||||
if ((await wizardStep1.isPresentButtonContinue()) &&
|
||||
!(await wizardStep2.isPresentFieldName()) )
|
||||
{
|
||||
|
||||
await wizardStep1.clickButtonContinue();
|
||||
|
||||
}
|
||||
else break;
|
||||
}
|
||||
while (count-->0)
|
||||
|
||||
await wizardStep2.fillName(cur.name);
|
||||
await wizardStep2.fillTicker(cur.ticker);
|
||||
await wizardStep2.fillDecimals(cur.decimals);
|
||||
do {
|
||||
await wizardStep2.fillName(cur.name);
|
||||
}
|
||||
while(await wizardStep2.isPresentWarningName());
|
||||
|
||||
do {
|
||||
await wizardStep2.fillTicker(cur.ticker);
|
||||
}
|
||||
while(await wizardStep2.isPresentWarningTicker());
|
||||
|
||||
do {
|
||||
await wizardStep2.fillDecimals(cur.decimals);
|
||||
}
|
||||
while(await wizardStep2.isPresentWarningDecimals());
|
||||
|
||||
for (var i=0;i<cur.reservedTokens.length;i++)
|
||||
{
|
||||
await reservedTokens.fillReservedTokens(cur.reservedTokens[i]);
|
||||
|
@ -449,29 +459,46 @@ class User {
|
|||
|
||||
await wizardStep2.clickButtonContinue();
|
||||
|
||||
|
||||
await wizardStep3.fillWalletAddress(cur.walletAddress);
|
||||
/////////////////Step 3//////////
|
||||
do {
|
||||
await wizardStep3.fillWalletAddress(cur.walletAddress);
|
||||
} while (await wizardStep3.isPresentWarningWalletAddress());
|
||||
|
||||
await wizardStep3.setGasPrice(cur.gasPrice);
|
||||
if (cur.whitelisting) await wizardStep3.clickCheckboxWhitelistYes();
|
||||
else (await wizardStep3.fillMinCap(cur.minCap));
|
||||
if (cur.whitelisting) {
|
||||
await wizardStep3.clickCheckboxWhitelistYes();
|
||||
}
|
||||
else {
|
||||
do {
|
||||
await wizardStep3.fillMinCap(cur.minCap);
|
||||
}
|
||||
while(await wizardStep3.isPresentWarningMincap())
|
||||
};
|
||||
|
||||
|
||||
for (var i = 0; i < cur.tiers.length - 1; i++) {
|
||||
await tiers[i].fillTier();
|
||||
await wizardStep3.clickButtonAddTier();
|
||||
}
|
||||
await tiers[cur.tiers.length - 1].fillTier();
|
||||
await this.driver.sleep(5000);
|
||||
await wizardStep3.clickButtonContinue();
|
||||
|
||||
await this.driver.sleep(5000);
|
||||
|
||||
if (!(await wizardStep4.isPage())) {
|
||||
logger.info("Incorrect data in tiers");
|
||||
await wizardStep3.printWarnings();
|
||||
await wizardStep3.fillWalletAddress(cur.walletAddress);
|
||||
}
|
||||
|
||||
count=30;
|
||||
do {
|
||||
await this.driver.sleep(1000);
|
||||
|
||||
if ((await wizardStep3.isPresentButtonContinue()) &&
|
||||
!(await wizardStep4.isPresentModal()) )
|
||||
{
|
||||
await wizardStep3.clickButtonContinue();
|
||||
}
|
||||
else break;
|
||||
if (count==1){
|
||||
logger.info("Incorrect data in tiers");
|
||||
await wizardStep3.printWarnings();
|
||||
throw("Incorrect data in tiers");
|
||||
}
|
||||
}
|
||||
while (count-->0);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
var trCounter=0;
|
||||
|
@ -505,7 +532,7 @@ class User {
|
|||
}
|
||||
else {
|
||||
|
||||
if (!(await wizardStep4.isPage())) {//if modal NOT present
|
||||
if (!(await wizardStep4.isPresentModal())) {//if modal NOT present
|
||||
await wizardStep4.waitUntilLoaderGone();
|
||||
await wizardStep4.clickButtonOk();
|
||||
b = false;
|
||||
|
@ -587,7 +614,7 @@ class User {
|
|||
|
||||
async contribute(amount){
|
||||
logger.info(this.account + " contribution = "+amount);
|
||||
logger.info(this. account+" balance = "+ Utils.getBalance(this. account));
|
||||
//logger.info(this. account+" balance = "+ Utils.getBalance(this. account));
|
||||
var investPage = new InvestPage(this.driver);
|
||||
await investPage.waitUntilLoaderGone();
|
||||
await investPage.fillInvest(amount);
|
||||
|
@ -631,7 +658,7 @@ class User {
|
|||
|
||||
await investPage.clickButtonOK();
|
||||
await investPage.waitUntilLoaderGone();
|
||||
await this.driver.sleep(3000);
|
||||
await this.driver.sleep(2000);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -647,8 +674,8 @@ class User {
|
|||
var curURL=await investPage.getURL();
|
||||
if(url!=curURL) await investPage.open(url);
|
||||
await investPage.waitUntilLoaderGone();
|
||||
await this.driver.sleep(2000);
|
||||
await investPage.refresh();
|
||||
//await this.driver.sleep(2000);
|
||||
// await investPage.refresh();
|
||||
await investPage.refresh();
|
||||
await this.driver.sleep(4000);
|
||||
let s=await investPage.getBalance();
|
||||
|
|
|
@ -8,7 +8,6 @@ const webdriver = require('selenium-webdriver'),
|
|||
firefox = require('selenium-webdriver/firefox'),
|
||||
by = require('selenium-webdriver/lib/by');
|
||||
const By=by.By;
|
||||
//const buttonInvest=By.xpath('//*[@id="root"]/div/section/div[3]/a');
|
||||
const buttonInvest=By.className("button button_fill");
|
||||
|
||||
class CrowdsalePage extends page.Page{
|
||||
|
|
|
@ -10,7 +10,6 @@ const webdriver = require('selenium-webdriver'),
|
|||
by = require('selenium-webdriver/lib/by');
|
||||
const By=by.By;
|
||||
const buttonContribute=By.className("button button_fill");
|
||||
|
||||
const fieldInvest=By.className("invest-form-input");
|
||||
const buttonOk=By.className("swal2-confirm swal2-styled");
|
||||
const fieldBalance=By.className("balance-title");
|
||||
|
|
|
@ -86,9 +86,18 @@ class ReservedTokensPage extends Page{
|
|||
|
||||
async fillReservedTokens(reservedTokens){
|
||||
logger.info(this.name+": ");
|
||||
await this.fillAddress(reservedTokens.address);
|
||||
|
||||
do {
|
||||
await this.fillAddress(reservedTokens.address);
|
||||
}
|
||||
while(await this.isPresentWarningAddress());
|
||||
|
||||
await this.setDimension(reservedTokens.dimension);
|
||||
await this.fillValue(reservedTokens.value);
|
||||
|
||||
do {
|
||||
await this.fillValue(reservedTokens.value);
|
||||
}
|
||||
while(await this.isPresentWarningValue());
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -42,8 +42,50 @@ class TierPage extends page.Page {
|
|||
this.checkboxModifyOn;
|
||||
this.checkboxModifyOff;
|
||||
this.itemsRemove=[];
|
||||
this.warningName;
|
||||
this.warningStartTime;
|
||||
this.warningEndTime;
|
||||
this.warningRate;
|
||||
this.warningSupply;
|
||||
this.warningRate;
|
||||
this.warningWhAddress;
|
||||
this.warningWhMin;
|
||||
this.warningWhMax;
|
||||
}
|
||||
|
||||
|
||||
async initWarnings(){
|
||||
try {
|
||||
logger.info(this.name + " :init warnings:");
|
||||
const locator = By.xpath("//p[@style='color: red; font-weight: bold; font-size: 12px; width: 100%; height: 10px;']");
|
||||
var arr = await super.findWithWait(locator);
|
||||
|
||||
let ci_tresh=2;
|
||||
let ci_mult=5;
|
||||
|
||||
if (wizardStep3.WizardStep3.getFlagCustom()) ci_tresh=3;
|
||||
if (wizardStep3.WizardStep3.getFlagWHitelising()) ci_mult=8;
|
||||
this.warningName = arr[ci_tresh+(this.number)*ci_mult];
|
||||
this.warningStartTime=arr[ci_tresh+(this.number)*ci_mult+1];
|
||||
this.warningEndTime=arr[ci_tresh+(this.number)*ci_mult+2];
|
||||
this.warningRate=arr[ci_tresh+(this.number)*ci_mult+3];
|
||||
this.warningSupply=arr[ci_tresh+(this.number)*ci_mult+4];
|
||||
this.warningWhAddress=arr[ci_tresh+(this.number)*ci_mult+5];
|
||||
this.warningWhMin=arr[ci_tresh+(this.number)*ci_mult+6];
|
||||
this.warningWhMax=arr[ci_tresh+(this.number)*ci_mult+7];
|
||||
return arr;
|
||||
}
|
||||
catch(err){
|
||||
logger.info(this.name+": dont contain warning elements");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
async initItemsRemove(){
|
||||
var arr = await super.findWithWait(itemsRemove);
|
||||
for (var i=0;i<arr.length;i++)
|
||||
|
@ -92,13 +134,36 @@ class TierPage extends page.Page {
|
|||
async fillTier()
|
||||
{ logger.info(this.name+"fill tier: ");
|
||||
|
||||
await this.fillRate();
|
||||
await this.fillSetupName();
|
||||
await this.fillSupply();
|
||||
await this.setModify();
|
||||
await this.fillStartTime();
|
||||
await this.fillEndTime();
|
||||
//await this.driver.sleep(3000);
|
||||
do {
|
||||
await this.fillRate();
|
||||
|
||||
}
|
||||
while(await this.isPresentWarningRate());
|
||||
|
||||
do {
|
||||
await this.fillSetupName();
|
||||
|
||||
}
|
||||
while(await this.isPresentWarningName());
|
||||
|
||||
do {
|
||||
await this.fillSupply();
|
||||
|
||||
}
|
||||
while(await this.isPresentWarningSupply());
|
||||
|
||||
do {
|
||||
await this.fillStartTime();
|
||||
}
|
||||
while(await this.isPresentWarningStartTime());
|
||||
do {
|
||||
await this.fillEndTime();
|
||||
}
|
||||
while(await this.isPresentWarningEndTime());
|
||||
|
||||
await this.setModify();
|
||||
|
||||
|
||||
if (this.tier.whitelist!=null) await this.fillWhitelist();
|
||||
|
||||
}
|
||||
|
@ -117,8 +182,6 @@ class TierPage extends page.Page {
|
|||
{ await this.init();
|
||||
logger.info(this.name+"field Rate: ");
|
||||
let locator=this.fieldRateTier;
|
||||
//if (this.number==0) {locator=fieldRateTier1;}
|
||||
//else {locator=by.By.xpath(fieldRate1+this.number+fieldRate2);}
|
||||
await super.clearField(locator);
|
||||
await super.fillWithWait(locator,this.tier.rate);
|
||||
}
|
||||
|
@ -162,6 +225,7 @@ class TierPage extends page.Page {
|
|||
this.tier.startTime=Utils.convertTimeToMdy(this.tier.startTime);
|
||||
|
||||
}
|
||||
await super.clickWithWait(locator);
|
||||
await super.fillWithWait(locator,this.tier.startDate);
|
||||
const action=this.driver.actions();
|
||||
await action.sendKeys(key.TAB).perform();
|
||||
|
@ -191,7 +255,7 @@ class TierPage extends page.Page {
|
|||
this.tier.endTime=Utils.convertTimeToMdy(this.tier.endTime);
|
||||
|
||||
}
|
||||
|
||||
await super.clickWithWait(locator);
|
||||
await super.fillWithWait(locator,this.tier.endDate);
|
||||
const action=this.driver.actions();
|
||||
await action.sendKeys(key.TAB).perform();
|
||||
|
@ -206,9 +270,19 @@ class TierPage extends page.Page {
|
|||
try {
|
||||
for (var i = 0; i < this.tier.whitelist.length; i++) {
|
||||
logger.info(this.name + "whitelist #" + i + ": ");
|
||||
await this.fillAddress(this.tier.whitelist[i].address);
|
||||
await this.fillMin(this.tier.whitelist[i].min);
|
||||
await this.fillMax(this.tier.whitelist[i].max);
|
||||
|
||||
do {
|
||||
await this.fillAddress(this.tier.whitelist[i].address);
|
||||
}
|
||||
while(await this.isPresentWarningWhAddress());
|
||||
do {
|
||||
await this.fillMin(this.tier.whitelist[i].min);
|
||||
}
|
||||
while(await this.isPresentWarningWhMin());
|
||||
do {
|
||||
await this.fillMax(this.tier.whitelist[i].max);
|
||||
}
|
||||
while(await this.isPresentWarningWhMax());
|
||||
await this.clickButtonAdd();
|
||||
}
|
||||
return true;
|
||||
|
@ -269,5 +343,65 @@ async clickButtonClearAll(){
|
|||
|
||||
}
|
||||
|
||||
|
||||
async isPresentWarningName(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningName);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
async isPresentWarningStartTime(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningStartTime);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
async isPresentWarningEndTime(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningEndTime);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
async isPresentWarningRate(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningRate);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
async isPresentWarningSupply(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningSupply);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
async isPresentWarningWhAddress(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningWhAddress);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
async isPresentWarningWhMin(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningWhMin);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
async isPresentWarningWhMax(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningWhMax);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
module.exports.TierPage=TierPage;
|
||||
|
|
|
@ -18,7 +18,7 @@ class WizardStep1 extends page.Page{
|
|||
super(driver);
|
||||
this.URL;
|
||||
this.name="WizardStep1 page: ";
|
||||
|
||||
this.title="CROWDSALE CONTRACT";
|
||||
}
|
||||
|
||||
async isPresentButtonContinue(){
|
||||
|
|
|
@ -28,9 +28,6 @@ class WizardStep2 extends page.Page {
|
|||
this.warningValue;
|
||||
this.title="TOKEN SETUP";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
async init(){
|
||||
try {
|
||||
|
|
|
@ -8,11 +8,9 @@ const webdriver = require('selenium-webdriver'),
|
|||
firefox = require('selenium-webdriver/firefox'),
|
||||
by = require('selenium-webdriver/lib/by');
|
||||
const By=by.By;
|
||||
const warningWalletAddress=By.xpath('//*[@id="root"]/div/section/div[2]/div[2]/div[2]/div[1]/p[2]');
|
||||
|
||||
const buttonContinue=By.xpath("//*[contains(text(),'Continue')]");
|
||||
const buttonAddTier=By.className("button button_fill_secondary");
|
||||
const buttonUploadCSV=By.className("fa fa-upload");
|
||||
|
||||
const buttonOK=By.className("swal2-confirm swal2-styled");
|
||||
|
||||
let flagCustom=false;
|
||||
|
@ -36,6 +34,12 @@ class WizardStep3 extends page.Page{
|
|||
this.fieldMinCap;
|
||||
this.title="CROWDSALE SETUP";
|
||||
this.warningWalletAddress;
|
||||
this.warningCustomGasPrice;
|
||||
this.warningMincap;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
static getFlagCustom(){return flagCustom;}
|
||||
static getFlagWHitelising(){return flagWHitelising;}
|
||||
|
@ -57,7 +61,13 @@ async printWarnings(){
|
|||
const locator = By.xpath("//p[@style='color: red; font-weight: bold; font-size: 12px; width: 100%; height: 10px;']");
|
||||
var arr = await super.findWithWait(locator);
|
||||
this.warningWalletAddress = arr[0];
|
||||
|
||||
if (flagCustom)
|
||||
{ this.warningMincap=arr[2];
|
||||
this.warningCustomGasPrice=arr[1];
|
||||
}
|
||||
else
|
||||
{ this.warningMincap=arr[1];
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
catch(err){
|
||||
|
@ -111,13 +121,8 @@ catch(err)
|
|||
async fillWalletAddress(address){
|
||||
await this.init();
|
||||
logger.info(this.name+"field WalletAddress: ");
|
||||
do {
|
||||
await super.clearField(this.fieldWalletAddress);
|
||||
|
||||
await super.fillWithWait(this.fieldWalletAddress, address);
|
||||
await this.driver.sleep(1000);
|
||||
}
|
||||
while (await this.isPresentWarningWalletAddress())
|
||||
await super.clearField(this.fieldWalletAddress);
|
||||
await super.fillWithWait(this.fieldWalletAddress, address);
|
||||
}
|
||||
|
||||
|
||||
|
@ -187,7 +192,7 @@ catch(err)
|
|||
async setGasPrice(value){
|
||||
logger.info(this.name+"setGasPrice: =" + value);
|
||||
switch(value){
|
||||
case 2:{await this.clickCheckboxGasPriceSafe();break;}
|
||||
case 1:{await this.clickCheckboxGasPriceSafe();break;}
|
||||
case 4:{await this.clickCheckboxGasPriceNormal();break;}
|
||||
case 30:{await this.clickCheckboxGasPriceFast();break;}
|
||||
default:{
|
||||
|
@ -203,21 +208,27 @@ catch(err)
|
|||
await super.clearField(this.fieldMinCap,1);
|
||||
await super.fillWithWait(this.fieldMinCap,value);
|
||||
}
|
||||
async isPresentWarningMincap(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningMincap);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
async isPresentWarningCustomGasPrice(){
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningCustomGasPrice);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
|
||||
|
||||
async isPresentWarningWalletAddress(){
|
||||
var b=false;
|
||||
try {
|
||||
logger.info(this.name+"red warning if data wrong :");
|
||||
//await this.driver.sleep(1000);
|
||||
var s=await super.getTextByLocatorFast(warningWalletAddress);
|
||||
logger.info("text received ="+s);
|
||||
return (s!="");
|
||||
}
|
||||
catch(err){
|
||||
logger.info("Can not find red warning for wallet address")
|
||||
console.log(err); return false;}
|
||||
|
||||
async isPresentWarningWalletAddress() {
|
||||
logger.info(this.name + "is present warning :");
|
||||
await this.initWarnings();
|
||||
let s = await super.getTextByElement(this.warningWalletAddress);
|
||||
if (s != "") { logger.info("present");return true;}
|
||||
else {logger.info("not present");return false;}
|
||||
}
|
||||
|
||||
async isPresentFieldWalletAddress(){
|
||||
|
@ -268,7 +279,12 @@ async clickButtonOk(){
|
|||
|
||||
}
|
||||
|
||||
async isPresentButtonContinue(){
|
||||
var b=await super.isElementPresent(buttonContinue);
|
||||
logger.info(this.name+": is present button Continue: "+b);
|
||||
return b;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@ const webdriver = require('selenium-webdriver'),
|
|||
const By=by.By;
|
||||
const buttonContinue=By.xpath("//*[contains(text(),'Continue')]");
|
||||
const modal=By.className("modal");
|
||||
const buttonOK=By.xpath('/html/body/div[2]/div/div[3]/button[1]');
|
||||
//const buttonOK=By.xpath('/html/body/div[2]/div/div[3]/button[1]');
|
||||
const buttonOK=By.className("swal2-confirm swal2-styled");
|
||||
const buttonSkipTransaction=By.className("no_image button button_fill");
|
||||
const buttonYes=By.className("swal2-confirm swal2-styled");
|
||||
|
||||
|
@ -51,7 +52,7 @@ class WizardStep4 extends page.Page{
|
|||
}
|
||||
|
||||
|
||||
async isPage(){
|
||||
async isPresentModal(){
|
||||
logger.info(this.name+"Is present Modal: ");
|
||||
return await super.isElementPresent(modal);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
}
|
||||
],
|
||||
"walletAddress":"0x56B2e3C3cFf7f3921Dc2e0F8B8e20d1eEc29216b",
|
||||
"gasprice":23,
|
||||
"gasprice":1,
|
||||
"mincap": 5,
|
||||
"whitelisting":false,
|
||||
"tiers":[
|
||||
|
@ -20,7 +20,7 @@
|
|||
"allowModify": false,
|
||||
"startDate": "",
|
||||
"startTime": "",
|
||||
"endDate":"180000",
|
||||
"endDate":"240000",
|
||||
"endTime":"",
|
||||
"rate":100,
|
||||
"supply": 20,
|
||||
|
|
|
@ -576,7 +576,7 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
assert.equal(b, true, 'Test FAILED. Wizard step#3: User is NOT able to download CVS file with whitelisted addresses');
|
||||
|
||||
});
|
||||
test.it.skip('Wizard step#3: Downloaded whitelist addresses dont contain invalid data',
|
||||
test.it('Wizard step#3: Downloaded whitelist addresses dont contain invalid data',
|
||||
async function () {
|
||||
assert.equal(true, true, "Test FAILED. Wizard step#3: Downloaded whitelist addresses contain invalid data");
|
||||
|
||||
|
@ -621,8 +621,8 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
owner = Owner;//Owner
|
||||
|
||||
await owner.setMetaMaskAccount();
|
||||
startTime=new Date(Date.now()).getTime()+80000+120000;
|
||||
crowdsale1 = await owner.createCrowdsale(scenario1,3);
|
||||
startTime=new Date(Date.now()).getTime()+80000+180000;
|
||||
crowdsale1 = await owner.createCrowdsale(scenario1,4);
|
||||
logger.info("TokenAddress: " + crowdsale1.tokenAddress);
|
||||
logger.info("ContractAddress: " + crowdsale1.contractAddress);
|
||||
logger.info("url: " + crowdsale1.url);
|
||||
|
@ -660,7 +660,8 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
|
||||
});
|
||||
|
||||
test.it.skip('Investor can buy amount equal mincap',
|
||||
//SKIP
|
||||
test.it('Investor can buy amount equal mincap',
|
||||
async function() {
|
||||
assert.equal(flagCrowdsale,true);
|
||||
|
||||
|
@ -681,7 +682,17 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
|
||||
});
|
||||
|
||||
test.it.skip('Investor can buy less than mincap after first transaction', async function() {
|
||||
test.it.skip('Investor not able to buy amount significally more than total supply', async function() {
|
||||
assert.equal(flagCrowdsale,true);
|
||||
investor=Investor1;
|
||||
await investor.open(crowdsale1.url);
|
||||
balance=await investor.getBalanceFromPage(crowdsale1.url);
|
||||
contribution=1234567890;
|
||||
b = await investor.contribute(contribution);
|
||||
assert.equal(b, false, "Test FAILED. Investor is able to buy amount significally more than total supply");
|
||||
});
|
||||
|
||||
test.it('Investor can buy less than mincap after first transaction', async function() {
|
||||
assert.equal(flagCrowdsale,true);
|
||||
|
||||
b=false;
|
||||
|
@ -690,8 +701,9 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
balance=await investor.getBalanceFromPage(crowdsale1.url);
|
||||
contribution=smallAmount;
|
||||
b = await investor.contribute(contribution);
|
||||
assert.equal(b, true, "Test FAILED. Investor can not buy less than mincap after first transaction");
|
||||
newBalance=await investor.getBalanceFromPage(crowdsale1.url);
|
||||
b=Math.abs((parseFloat(newBalance)-parseFloat(balance))-contribution)<=smallAmount;
|
||||
b=(newBalance!=balance)&&(Math.abs((parseFloat(newBalance)-parseFloat(balance))-contribution)<=smallAmount);
|
||||
logger.info("Difference="+(parseFloat(newBalance)-parseFloat(balance)));
|
||||
logger.info("Contribution="+contribution);
|
||||
logger.info("After first:Old balance="+balance+" New balance="+newBalance+" BBB="+b);
|
||||
|
@ -721,7 +733,7 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
logger.warn("Test PASSED. IDisabled to buy after crowdsale is finalized");
|
||||
});
|
||||
|
||||
test.it.skip('Owner able to distribute if crowdsale time expired but not all tokens were sold', async function() {
|
||||
test.it('Owner able to distribute if crowdsale time expired but not all tokens were sold', async function() {
|
||||
assert.equal(flagCrowdsale,true);
|
||||
b=false;
|
||||
owner=Owner;
|
||||
|
@ -732,7 +744,7 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
flagDistribute=true;
|
||||
});
|
||||
|
||||
test.it.skip('Reserved address has received correct quantity of tokens after distribution', async function() {
|
||||
test.it('Reserved address has received correct quantity of tokens after distribution', async function() {
|
||||
assert.equal(flagCrowdsale,true);
|
||||
assert.equal(flagDistribute,true);
|
||||
flagDistribute=false;
|
||||
|
@ -745,7 +757,7 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
flagDistribute=true;
|
||||
});
|
||||
|
||||
test.it.skip('Owner able to finalize ( if crowdsale time expired but not all tokens were sold)', async function() {
|
||||
test.it('Owner able to finalize ( if crowdsale time expired but not all tokens were sold)', async function() {
|
||||
assert.equal(flagCrowdsale,true);
|
||||
assert.equal(flagDistribute,true);
|
||||
b=false;
|
||||
|
@ -756,7 +768,7 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
logger.warn("Test PASSED.'Owner can finalize (after all tokens were sold) ");
|
||||
|
||||
});
|
||||
test.it.skip('Investor has received correct quantity of tokens after finalization', async function() {
|
||||
test.it('Investor has received correct quantity of tokens after finalization', async function() {
|
||||
assert.equal(flagCrowdsale,true);
|
||||
assert.equal(flagDistribute,true);
|
||||
investor=Investor1;
|
||||
|
@ -1122,6 +1134,7 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
logger.warn("Test PASSED. Investor can NOT buy more than assigned max");
|
||||
|
||||
});
|
||||
|
||||
test.it('Whitelisted investor is able to buy assigned max', async function() {
|
||||
assert.equal(flagCrowdsale,true);
|
||||
assert.equal(flagStartTimeChanged,true);
|
||||
|
|
|
@ -149,6 +149,27 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
});
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
test.it('Owner can create crowdsale(scenario testSuite1.json),1 tier, not modifiable, no whitelist,1 reserved',
|
||||
async function () {
|
||||
b=false;
|
||||
owner = Owner;//Owner
|
||||
|
||||
await owner.setMetaMaskAccount();
|
||||
startTime=new Date(Date.now()).getTime()+80000+120000;
|
||||
crowdsale1 = await owner.createCrowdsale(scenario2,3);
|
||||
logger.info("TokenAddress: " + crowdsale1.tokenAddress);
|
||||
logger.info("ContractAddress: " + crowdsale1.contractAddress);
|
||||
logger.info("url: " + crowdsale1.url);
|
||||
b = (crowdsale1.tokenAddress != "") & (crowdsale1.contractAddress != "") & (crowdsale1.url != "");
|
||||
flagCrowdsale=b;
|
||||
assert.equal(b, true, "Test FAILED. Crowdsale has NOT created ");
|
||||
logger.error("Test PASSED. Owner can create crowdsale,no whitelist,reserved");
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
test.it('User can open wizard welcome page: https://wizard.oracles.org/',
|
||||
async function () {
|
||||
|
@ -527,7 +548,7 @@ test.describe('POA token-wizard. Test suite #2', function() {
|
|||
|
||||
|
||||
|
||||
test.it('Wizard step#3: User is able to download CVS file with whitelisted addresses',
|
||||
test.it.skip('Wizard step#3: User is able to download CVS file with whitelisted addresses',
|
||||
async function () {
|
||||
let rightAddresses=11;
|
||||
|
||||
|
|
Loading…
Reference in New Issue