问题
Im trying to add a screenshot as an attachment in allure reports using mocha-allure-reporter. I dont get any errors, but the screenshot does not have save in ./reports/allure-results, and no console log either. Is this the correct way to use allure.createAttachment?
declare const allure: any;
afterEach('first step', function () {
allure.createStep('initial', () => {
browser.takeScreenshot().then(function (png) {
allure.createAttachment('Screenshot', function () {
return new Buffer(png, 'base64');
}, 'image/png')();
console.log('screenshot saved');
});
});
});
config
mochaOpts: {
reporter: 'mocha-multi-reporters',
reporterOptions: {
reporterEnabled:
mocha-allure-reporter
//
//
mochaAllureReporterReporterOptions: {
targetDir: './reports/allure-results',
}
来源:https://stackoverflow.com/questions/55125425/createattachment-using-mocha-allure-reporter