我能够生成摩卡真棒html报告,但一切正常,但我想在html报告中添加屏幕快照,以cypress屏幕截图为例,但想添加html报告。有什么办法可以添加它们?
考虑mochawesome addContext。这将为报告注入任何价值。我相当确定生成的html报告将显示给定路径的图像。这可能需要进一步阅读addContext。
const { expect } = require('chai');
const addContext = require('mochawesome/addContext');
describe('Cypress tests.', function () {
before(function () {
// Perform Cypress things.
// Take screenshots.
};
after(function () {
const title = 'Screenshot of thing.';
const value = 'path/to/screenshot.png';
addContext(this, {
title,
value,
};
it('Foo should equal batz.', function () {
// Expect some things.
};
};