Srinivas
Srinivas

Reputation: 1

Allure reports are not generated in Protractor

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

Upvotes: 0

Views: 3392

Answers (1)

alecxe
alecxe

Reputation: 473833

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.

Upvotes: 1

Related Questions