Protractor 量角器中报告/显示断言失败,html报告为步骤失败

Protractor 量角器中报告/显示断言失败,html报告为步骤失败,protractor,cucumber,reporting,assertion,Protractor,Cucumber,Reporting,Assertion,我一直试图在量角器的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.take

我一直试图在量角器的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");
    }
如何对报告中的步骤级失败(或断言失败)执行相同的操作,这样,如果某个场景失败,我只需查看报告就可以知道哪个步骤完全失败了