Allure reports are not generated in Protractor

混江龙づ霸主 提交于 2019-12-10 12:02:44

问题


I included the below code in my conf.js file but the Allure reports are not getting generated.

onPrepare : function() {
    var AllureReporter = require('jasmine-allure-reporter');
    jasmine.getEnv().addReporter(
        new AllureReporter({
            allureReport : {
                resultsDir : 'allure-results'
            }
        })
    );

    jasmine.getEnv().afterEach(function(done) {
        browser.takeScreenshot().then(function(png) {
            allure.createAttachment('Screenshot', function() {
                return new Buffer(png, 'base64')
            }, 'image/png')();
            done();
        })
    });
}

Please let me know if I am missing anything.
Thanks,
Srinivas


回答1:


Register a top suite after each function:

onPrepare : function() {
    var AllureReporter = require('jasmine-allure-reporter');
    var reporter = new AllureReporter({
        allureReport : {
            resultsDir : 'allure-results'
        }
    });
    jasmine.getEnv().addReporter(reporter);

    jasmine.getEnv().topSuite().afterEach({fn: function() {
        browser.takeScreenshot().then(function(png) {
            allure.createAttachment('Screenshot', function() {
                return new Buffer(png, 'base64')
            }, 'image/png')();
        })
    }});
}

Not tested.



来源:https://stackoverflow.com/questions/35967224/allure-reports-are-not-generated-in-protractor

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