mercredi 28 novembre 2018

For loop prints log to console prior to the action actually occurred

i am automating a spec which create sales quotation

for(var j=0;j<1000;j++)
{    
  element(by.cssContainingText('option','Sales Quotation')).click();
  element(by.id('Vendor_Customer_Name')).sendKeys("Abc enterprise");
  browser.driver.sleep(2000); // wait for rendring data
  element.all(by.css(".ui-corner-all")).first().click();
  for(var i=0; i<data.length;)
  {
    element(by.id('ItemCode_1')).sendKeys(data[i].Value);
    i++;
    browser.actions().sendKeys(protractor.Key.ENTER).perform();
    element(by.id('ItemQty_1')).sendKeys(data[i].Value); //Qty for quote
    i++;           
    browser.actions().sendKeys(protractor.Key.TAB).perform();
    browser.actions().sendKeys(protractor.Key.TAB).perform();
    element(by.id('ItemRate_1')).sendKeys(data[i].Value);
    i++;
    browser.actions().sendKeys(protractor.Key.TAB).perform();
    browser.actions().sendKeys(protractor.Key.TAB).perform();
    browser.actions().sendKeys(protractor.Key.TAB).perform();
    browser.actions().sendKeys(protractor.Key.ENTER).perform();
  }
  element(by.id('lnkSubmit')).click();
  element(by.xpath('//*[@id="lblSuccessMessage"]/button')).click();
  console.log("Sales Quotation No... ->"+j);
}

What it does is it prints sales quotation no. from 1 to 1000 prior to any single Sales Quote is really created how can i make it to print 1 by after Sales quotation is created

Aucun commentaire:

Enregistrer un commentaire