createAttachment using mocha-allure-reporter

2019-08-24 01:55发布

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',

}

0条回答
登录 后发表回答