HTML and screenshot reporter for testx.
This work is heavily based on Protractor Jasmine 2 HTML Reporter.
In your Protractor configuration file, register testx-html-reporter:
var HtmlReporter = require('testx-html-reporter');
exports.config = {
// ...
onPrepare: function() {
jasmine.getEnv().addReporter(
new HtmlReporter({
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 HtmlReporter({
savePath: './test/reports/'
}));
Default folder: ./
By default the passed specifications will not be included in the report. To include them do:
jasmine.getEnv().addReporter(new HtmlReporter({
showPassed: true
}));
Default value: false
By default the number of skipped specifications will not be included in the report. To include it do:
jasmine.getEnv().addReporter(new HtmlReporter({
showSkippedCount: true
}));
Default value: false
By default the stacktrace of failed assertions will not be included in the report. To include it do:
jasmine.getEnv().addReporter(new HtmlReporter({
showStacktrace: true
}));
Default value: false
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 HtmlReporter({
savePath: './test/reports/',
screenshotsFolder: 'images'
}));
Default folder: screenshots
When this option is enabled, reporter will create screenshots for specs.
jasmine.getEnv().addReporter(new HtmlReporter({
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 HtmlReporter({
takeScreenshots: true,
takeScreenshotsOnlyOnFailures: true
}));
Default is false
(So screenshots are always generated)
Filename for html report.
jasmine.getEnv().addReporter(new HtmlReporter({
savePath: './test/reports/',
filePrefix: 'index'
}));
Default is htmlReport.html
This option allow you to create diferent HTML for each test suite.
jasmine.getEnv().addReporter(new HtmlReporter({
consolidate: true,
consolidateAll: true
}));
Default is false