Skip to content

Commit

Permalink
Merge pull request #163 from Evilweed/disablescreenshotsoption
Browse files Browse the repository at this point in the history
Disablescreenshotsoption
  • Loading branch information
miller45 authored Aug 21, 2019
2 parents 3b5b447 + 9cdb945 commit ad915b2
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 322 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
13 changes: 12 additions & 1 deletion examples/protractor.jasmine2.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ exports.config = {
// find its own unused port.
seleniumPort: null,

/* direct connect on my local system*/
directConnect:!!process.env.CHROMIUM_BIN,

// Chromedriver location is used to help the selenium standalone server
// find chromedriver. This will be passed to the selenium jar as
// the system property webdriver.chrome.driver. If null, selenium will
Expand Down Expand Up @@ -53,7 +56,15 @@ exports.config = {
// https://code.google.com/p/selenium/wiki/DesiredCapabilities
// and
// https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js
capabilities: {
capabilities:!!process.env.CHROMIUM_BIN?{
'browserName': 'chrome',
'applicationName': 'chromium',
'chromeOptions': {
'binary': process.env.CHROMIUM_BIN,
'args': ['--lang=en',
'--window-size=1680,1050']
}
}:{
browserName: 'chrome',
logName: 'Chrome - English',
version: '',
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
Loading

0 comments on commit ad915b2

Please sign in to comment.