首页 > 解决方案 > 报告/显示 Protractor Cucumber html 中的断言失败报告为步骤失败

问题描述

我一直试图在量角器的黄瓜 html 报告中将断言失败报告为步骤失败,但没有成功。在 hooks.ts 文件中,After 步骤配置如下,用于场景级别故障;

After(async function(scenario) {
    if (scenario.result.status === Status.FAILED) {
        // screenShot is a base-64 encoded PNG
         const screenShot = await browser.takeScreenshot();
         this.attach(screenShot, "image/png");
    }

我如何对报告中的步骤级别失败(或断言失败)执行相同的操作,这样,如果场景失败,我只需查看报告即可知道哪个步骤完全失败。

标签: protractorcucumberreportingassertion

解决方案


推荐阅读