HTML reporter for Jasmine2 and Protractor that will include screenshots of each test if you want and display suits hierarchically.
The protractor-html-hierarchical-reporter
is available via npm:
$ npm install protractor-html-hierarchical-reporter --save-dev
In your Protractor configuration file, register protractor-html-hierarchical-reporter in jasmine:
var HierarchicalHTMLReporter = require('protractor-html-hierarchical-reporter');
exports.config = {
// ...
onPrepare: function() {
jasmine.getEnv().addReporter(
new HierarchicalHTMLReporter({
savePath: 'target/screenshots'
})
);
}
}
Output directory for created files. All screenshots and reports will be stored here.
If the directory doesn't exist, it will be created automatically or otherwise cleaned before running the test suite.
jasmine.getEnv().addReporter(new HierarchicalHTMLReporter({
savePath: './test/reports/'
}));
Default folder: ./
By default the screenshots are stored in a folder inside the default path
If the directory doesn't exist, it will be created automatically or otherwise cleaned before running the test suite.
jasmine.getEnv().addReporter(new HierarchicalHTMLReporter({
savePath: './test/reports/',
screenshotsFolder: 'images'
}));
Default folder: screenshots
When this option is enabled, reporter will create screenshots for specs.
jasmine.getEnv().addReporter(new HierarchicalHTMLReporter({
takeScreenshots: false
}));
Default is true
This option allows you to choose if create screenshots always or only when failures. If you disable screenshots, obviously this option will not be taken into account.
jasmine.getEnv().addReporter(new HierarchicalHTMLReporter({
takeScreenshots: true,
takeScreenshotsOnlyOnFailures: true
}));
Default is false
(So screenshots are always generated)
Filename for html report.
jasmine.getEnv().addReporter(new HierarchicalHTMLReporter({
savePath: './test/reports/',
filePrefix: 'index'
}));
Default is htmlReport.html