diff --git a/CHANGES.md b/CHANGES.md index 54bb8a3..22e5aba 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,7 @@ # Changelog +## Version 1.2.10 +* Added option for disabling all screenshots ## Version 1.2.9 * Added favico (from angulars) to report page diff --git a/README.md b/README.md index 4005c61..fa7fd41 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,18 @@ Default is `false`. Default is `false`. +### Disable all screenshots +If you want no screenshots at all, set the `disableScreenshots` option to true. + + ```javascript + new HtmlReporter({ + baseDirectory: 'tmp/reports' + , disableScreenshots: true + }); + ``` + + Default is `false`. + ### Add title for the html report (optional) Also you can define a document title for the html report generated using the `docTitle:` option: diff --git a/app/reporter.js b/app/reporter.js index de7c72b..647879f 100644 --- a/app/reporter.js +++ b/app/reporter.js @@ -186,6 +186,7 @@ function ScreenshotReporter(options) { options.gatherBrowserLogs || true; this.takeScreenShotsOnlyForFailedSpecs = options.takeScreenShotsOnlyForFailedSpecs || false; + this.disableScreenshots = options.disableScreenshots || false; this.clientDefaults = options.clientDefaults || {}; if (options.searchSettings) { //settings in earlier "format" there? this.clientDefaults.searchSettings = options.searchSettings; @@ -199,6 +200,7 @@ function ScreenshotReporter(options) { excludeSkippedSpecs: this.excludeSkippedSpecs, takeScreenShotsOnlyForFailedSpecs: this.takeScreenShotsOnlyForFailedSpecs, takeScreenShotsForSkippedSpecs: this.takeScreenShotsForSkippedSpecs, + disableScreenshots: this.disableScreenshots, metaDataBuilder: this.metaDataBuilder, pathBuilder: this.pathBuilder, sortFunction: this.sortFunction, @@ -339,7 +341,7 @@ class Jasmine2Reporter { metaData.browserLogs = []; - let considerScreenshot = !(this._screenshotReporter.takeScreenShotsOnlyForFailedSpecs && result.status === 'passed') + let considerScreenshot = !this._screenshotReporter.disableScreenshots && !(this._screenshotReporter.takeScreenShotsOnlyForFailedSpecs && result.status === 'passed') if (considerScreenshot) { metaData.screenShotFile = path.join(this._screenshotReporter.screenshotsSubfolder, screenShotFileName); diff --git a/index.js b/index.js index a40fb41..8aa40a6 100644 --- a/index.js +++ b/index.js @@ -4863,6 +4863,7 @@ function ScreenshotReporter(options) { this.takeScreenShotsForSkippedSpecs = options.takeScreenShotsForSkippedSpecs || false; this.gatherBrowserLogs = options.gatherBrowserLogs || true; this.takeScreenShotsOnlyForFailedSpecs = options.takeScreenShotsOnlyForFailedSpecs || false; + this.disableScreenshots = options.disableScreenshots || false; this.clientDefaults = options.clientDefaults || {}; if (options.searchSettings) { //settings in earlier "format" there? @@ -4877,6 +4878,7 @@ function ScreenshotReporter(options) { excludeSkippedSpecs: this.excludeSkippedSpecs, takeScreenShotsOnlyForFailedSpecs: this.takeScreenShotsOnlyForFailedSpecs, takeScreenShotsForSkippedSpecs: this.takeScreenShotsForSkippedSpecs, + disableScreenshots: this.disableScreenshots, metaDataBuilder: this.metaDataBuilder, pathBuilder: this.pathBuilder, sortFunction: this.sortFunction, @@ -5169,7 +5171,7 @@ var Jasmine2Reporter = function () { metaData.browserLogs = []; - considerScreenshot = !(this._screenshotReporter.takeScreenShotsOnlyForFailedSpecs && result.status === 'passed'); + considerScreenshot = !this._screenshotReporter.disableScreenshots && !(this._screenshotReporter.takeScreenShotsOnlyForFailedSpecs && result.status === 'passed'); if (considerScreenshot) { diff --git a/package.json b/package.json index 930d5f7..2f188ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "protractor-beautiful-reporter", - "version": "1.2.9", + "version": "1.2.10", "description": "An npm module and which generates your Protractor test reports in HTML (angular) with screenshots", "main": "index.js", "repository": {