protractor-jasmine2-screenshot-reporter
Advanced tools
Comparing version 0.1.2 to 0.1.3
36
index.js
@@ -7,3 +7,3 @@ var fs = require('fs'), | ||
require('string.prototype.startsWith'); | ||
require('string.prototype.startswith'); | ||
@@ -178,3 +178,13 @@ function Jasmine2ScreenShotReporter(opts) { | ||
var htmlReport = fs.openSync(opts.dest + opts.filename, 'w'); | ||
var output = printResults(suites[Object.keys(suites)[0]]); | ||
var output = ''; | ||
_.each(suites, function(suite) { | ||
output += printResults(suite); | ||
}); | ||
// Ideally this shouldn't happen, but some versions of jasmine will allow it | ||
_.each(specs, function(suite) { | ||
output += printSpec(suite); | ||
}); | ||
fs.writeSync(htmlReport, output, 0); | ||
@@ -185,5 +195,25 @@ fs.closeSync(htmlReport); | ||
// TODO: better template | ||
var printedSpecs = []; | ||
function printSpec(spec) { | ||
var suiteName = spec._suite ? spec._suite.fullName : ''; | ||
if (_.contains(printedSpecs, spec.id)) { | ||
return ''; | ||
} | ||
printedSpecs.push(spec.id); | ||
return '<li>' + marks[spec.status] + '<a href="' + spec.filename + '">' + spec.fullName.replace(suiteName, '').trim() + '</a> (' + getDuration(spec) + ' s)</li>'; | ||
} | ||
// TODO: proper nesting -> no need for magic | ||
var printedSuites = []; | ||
function printResults(suite) { | ||
var output = ''; | ||
if (_.contains(printedSuites, suite.id)) { | ||
return ''; | ||
} | ||
printedSuites.push(suite.id); | ||
output += '<ul style="list-style-type:none">'; | ||
@@ -194,3 +224,3 @@ output += '<h4>' + suite.fullName + ' (' + getDuration(suite) + ' s)</h4>'; | ||
spec = specs[spec.id]; | ||
output += '<li>' + marks[spec.status] + '<a href="' + spec.filename + '">' + spec.fullName.replace(suite.fullName, '').trim() + '</a> (' + getDuration(spec) + ' s)</li>'; | ||
output += printSpec(spec); | ||
}); | ||
@@ -197,0 +227,0 @@ |
{ | ||
"name": "protractor-jasmine2-screenshot-reporter", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Use the screenshot reporter to capture screenshots after each executed Protractor test case.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -77,3 +77,3 @@ ## Protractor screenshot reporter for Jasmine2 | ||
// will return chrome/your-spec-name.png | ||
return browserCapabilities.browserName + '/' + spec.fullName); | ||
return browserCapabilities.get('browserName') + '/' + currentSpec.fullName); | ||
} | ||
@@ -91,3 +91,3 @@ }));</code></pre> | ||
metadataBuilder: function(currentSpec, suites, browserCapabilities) { | ||
return { id: spec.id, os: browserCapabilities.browserName }; | ||
return { id: currentSpec.id, os: browserCapabilities.get('browserName') }; | ||
} | ||
@@ -94,0 +94,0 @@ }));</code></pre> |
11853
189