Skip to content

Commit

Permalink
added disableScreenshots option
Browse files Browse the repository at this point in the history
raise version to 1.2.10
  • Loading branch information
miller45 committed Aug 21, 2019
1 parent 81d4688 commit 9cdb945
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion app/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 9cdb945

Please sign in to comment.