问题
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