赏金6天后到期。此问题的答案有资格获得+50声誉奖励。尼古拉斯正在寻找一个标准答案:
请提供示例代码。。。我曾试图在互联网上搜索截图,并在失败时将异常添加到范围报告中,但可以理解。spark和html报告之间有什么区别?希望有人能提供示例代码。谢谢
3df52oht1#
如果您使用cucumber和量角器,您可以在失败的场景步骤上附加屏幕截图,您可以这样使用它
import { browser } from 'protractor';import { After } from 'cucumber';After(async function (scenario) { if (scenario.result.status === Status.FAILED) { const screenshot = await browser.takeScreenshot(); this.attach(screenshot, "image/png"); }});
import { browser } from 'protractor';
import { After } from 'cucumber';
After(async function (scenario) {
if (scenario.result.status === Status.FAILED) {
const screenshot = await browser.takeScreenshot();
this.attach(screenshot, "image/png");
}
});
1条答案
按热度按时间3df52oht1#
如果您使用cucumber和量角器,您可以在失败的场景步骤上附加屏幕截图,您可以这样使用它