protractor-jasmine2-screenshot-reporter
Advanced tools
Comparing version 0.1.5 to 0.1.6
17
index.js
@@ -79,3 +79,3 @@ var fs = require('fs'), | ||
var isSpecValid = function (spec) { | ||
var isSpecValid = function(spec) { | ||
// Don't screenshot skipped specs | ||
@@ -89,3 +89,7 @@ var isSkipped = opts.ignoreSkippedSpecs && spec.status === 'pending'; | ||
var hasValidSpecs = function (suite) { | ||
var isSpecReportable = function(spec) { | ||
return (opts.reportOnlyFailedSpecs && spec.status === 'failed') || !opts.reportOnlyFailedSpecs; | ||
}; | ||
var hasValidSpecs = function(suite) { | ||
var validSuites = false; | ||
@@ -102,3 +106,3 @@ var validSpecs = false; | ||
validSpecs = _.any(suite._specs, function(s) { | ||
return isSpecValid(s); | ||
return isSpecValid(s) || isSpecReportable(s); | ||
}); | ||
@@ -115,2 +119,3 @@ } | ||
opts.ignoreSkippedSpecs = opts.ignoreSkippedSpecs || false; | ||
opts.reportOnlyFailedSpecs = opts.hasOwnProperty('reportOnlyFailedSpecs') ? opts.reportOnlyFailedSpecs : true; | ||
opts.captureOnlyFailedSpecs = opts.captureOnlyFailedSpecs || false; | ||
@@ -181,3 +186,3 @@ opts.pathBuilder = opts.pathBuilder || pathBuilder; | ||
if (!isSpecValid(spec)) { | ||
spec.isPrinted = true; | ||
spec.skipPrinting = true; | ||
return; | ||
@@ -247,3 +252,5 @@ } | ||
var suiteName = spec._suite ? spec._suite.fullName : ''; | ||
if (spec.isPrinted) { | ||
console.log(spec.id, isSpecReportable(spec) ); | ||
if (spec.isPrinted || (spec.skipPrinting && !isSpecReportable(spec))) { | ||
return ''; | ||
@@ -250,0 +257,0 @@ } |
{ | ||
"name": "protractor-jasmine2-screenshot-reporter", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Use the screenshot reporter to capture screenshots after each executed Protractor test case.", | ||
@@ -44,3 +44,4 @@ "main": "index.js", | ||
} | ||
] | ||
], | ||
"scripts": {} | ||
} |
@@ -70,2 +70,11 @@ ## Protractor screenshot reporter for Jasmine2 | ||
### Report only failed specs (optional) | ||
This option is __enabled by default__ - in combination with <code>captureOnlyFailedSpecs</code>, it will capture and report screenshots only for failed specs. Turning this option off will cause the report to contain all specs, but screenshots will be captured only for failed specs. | ||
<pre><code>jasmine.getEnv().addReporter(new HtmlScreenshotReporter({ | ||
reportOnlyFailedSpecs: false, | ||
captureOnlyFailedSpecs: true | ||
}));</code></pre> | ||
### Path Builder (optional) | ||
@@ -78,3 +87,3 @@ | ||
// will return chrome/your-spec-name.png | ||
return browserCapabilities.get('browserName') + '/' + currentSpec.fullName); | ||
return browserCapabilities.get('browserName') + '/' + currentSpec.fullName; | ||
} | ||
@@ -81,0 +90,0 @@ }));</code></pre> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14558
244
104