Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
512 views
in Technique[技术] by (71.8m points)

javascript - Protractor : E2e: Allure report is showing a failed test step as passed, even it is showing the Test method as failed

Allure report is showing a failed test step as passed, even it is showing the Test method as failed.

enter image description here

Code:

async function attachScreenshot(filename: string) {
  await browser.takeScreenshot().then(function (png) {
    allure.createAttachment(filename, function () {
      return Buffer.from(png, 'base64')
    }, 'image/png')();
  })
}


async function trycatch() {
  try {
    await browser.wait(until.textToBePresentInElement(SpadesPageObj.SuccessMessage, message), 5000);
    await expect(SpadesPageObj.SuccessMessage.getText()).not.toContain(message);
    await attachScreenshot('');
    //await console.log("In try");

  }
  catch {
    console.log("In catch");
    await attachScreenshot('');
  }

} 

 fit('Client Add Contact', async () => {
    await allure.createStep("Click on Add Contact", async () => {
      await browser.wait(until.presenceOf(SpadesPageObj.ClientAddContact), 50000, 'Client Add Contact');
      await SpadesPageObj.ClientAddContact.click();
      await browser.wait(until.invisibilityOf(SpadesPageObj.loaderaddcontact), 50000, 'loader add contact invisibility');
      await trycatch();
    })();
    await allure.createStep("Verify Contact Created", async () => {    
      await SpadesPageObj.ContactFirstName.sendKeys(data.Contact.ContactFirstName);
      await SpadesPageObj.ContactLastName.sendKeys(data.Contact.ContactLastName);
      await SpadesPageObj.ContactEmail.sendKeys(data.Contact.ContactEmail);
      await SpadesPageObj.ContactWorkPhone.sendKeys(data.Contact.ContactWorkPhone);
      await SpadesPageObj.ContactLocation.sendKeys(data.Contact.ContactLocation);
      await browser.wait(until.presenceOf(SpadesPageObj.ContactLocValue), 50000, 'Contact Location Value select');
      await SpadesPageObj.ContactLocValue.click();
      await SpadesPageObj.SaveClientBtn.click();
      await browser.wait(until.textToBePresentInElement(SpadesPageObj.SuccessMessage, 'Contact added successfully'), 3000);
      await expect(SpadesPageObj.SuccessMessage.getText()).toEqual('Contact added successfullyy');
      await attachScreenshot('');
    })();
  });

In the last step 'Verify Contact Created' The test step is failing still it is displayed as passes icon in the allure report.

To me the code looks correct!

Could anyone suggest what should be done here ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...