createAttachment using mocha-allure-reporter

∥☆過路亽.° 提交于 2019-12-24 20:14:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!