A plugin to generate an Allure report out of Jasmine tests.
Add the lib into package.json
and then configure the plugin:
// conf.js
var AllureReporter = require('jasmine-allure-reporter');
jasmine.getEnv().addReporter(new AllureReporter({
resultsDir: 'allure-results'
}));
Put the above code into the onPrepare
inside of your conf.js
:
// conf.js
exports.config = {
framework: 'jasmine2',
onPrepare: function() {
var AllureReporter = require('jasmine-allure-reporter');
jasmine.getEnv().addReporter(new AllureReporter({
resultsDir: 'allure-results'
}));
}
}
The Reporter will generate xml files inside of a resultsDir
, then we need to generate HTML out of them. You can
use Maven for that. Copy ready-to-use pom.xml
from node_modules/jasmine-allure-reporter
and run:
mvn site -Dallure.results_pattern=allure-results
It will put HTMLs into target/site/allure-maven-plugin
folder. To serve them via localhost:1324 use:
mvn jetty:run -Djetty.port=1234
Otherwise choose one of other ways to generate HTML.
onPrepare: function () {
var AllureReporter = require('jasmine-allure-reporter');
jasmine.getEnv().addReporter(new AllureReporter());
jasmine.getEnv().afterEach(function(done){
browser.takeScreenshot().then(function (png) {
allure.createAttachment('Screenshot', function () {
return new Buffer(png, 'base64')
}, 'image/png')();
done();
})
});
}
Note done
callback!
allure-js-commons
.See the system tests to quickly check how the reporter works in real life:
node_modules/protractor/bin/protractor ./test/system/conf.js