Socket
Socket
Sign inDemoInstall

protractor-jasmine2-screenshot-reporter

Package Overview
Dependencies
5
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.6 to 0.1.7

83

index.js

@@ -30,2 +30,44 @@ var fs = require('fs'),

var linkTemplate = _.template(
'<li>' +
'<%= mark %>' +
'<a href="<%= filename %>"><%= name %></a> ' +
'(<%= duration %> s)' +
'<%= reason %>' +
'</li>'
);
var nonLinkTemplate = _.template(
'<li title="No screenshot was created for this test case.">' +
'<%= mark %>' +
'<%= name %> ' +
'(<%= duration %> s)' +
'<%= reason %>' +
'</li>'
);
var reportTemplate = _.template(
'<html>' +
'<head>' +
'<meta charset="utf-8">' +
'<style>' +
'body { font-family: Arial; }' +
'ul { list-style-position: inside; }' +
'.passed { padding: 0 1em; color: green; }' +
'.failed { padding: 0 1em; color: red; }' +
'.pending { padding: 0 1em; color: orange; }' +
'</style>' +
'</head>' +
'<body><%= report %></body>' +
'</html>'
);
var reasonsTemplate = _.template(
'<ul>' +
'<% _.forEach(reasons, function(reason) { %>' +
'<li><%- reason.message %></li>' +
'<% }); %>' +
'</ul>'
);
// write data into opts.dest as filename

@@ -220,3 +262,4 @@ var writeScreenshot = function (data, filename) {

this.jasmineDone = function() {
var output = '<html><head><meta charset="utf-8"><style>body{font-family:Arial;}ul{list-style-position: inside;}.passed{padding: 0 1em;color:green;}.failed{padding: 0 1em;color:red;}.pending{padding: 0 1em;color:red;}</style></head><body>';
var output = '';
if (runningSuite) {

@@ -235,17 +278,18 @@ // focused spec (fit) -- suiteDone was never called

output += '</body></html>';
fs.appendFileSync(opts.dest + opts.filename, output, {encoding: 'utf8'}, function(err){
if(err){
console.error('Error writing to file:' + opts.dest + opts.filename);
throw err;
fs.appendFileSync(
opts.dest + opts.filename,
reportTemplate({ report: output}),
{ encoding: 'utf8' },
function(err) {
if(err) {
console.error('Error writing to file:' + opts.dest + opts.filename);
throw err;
}
}
});
);
};
// TODO: better template
function printSpec(spec) {
var suiteName = spec._suite ? spec._suite.fullName : '';
console.log(spec.id, isSpecReportable(spec) );
var template = spec.filename ? linkTemplate : nonLinkTemplate;

@@ -257,3 +301,10 @@ if (spec.isPrinted || (spec.skipPrinting && !isSpecReportable(spec))) {

spec.isPrinted = true;
return '<li>' + marks[spec.status] + '<a href="' + encodeURIComponent(spec.filename) + '">' + spec.fullName.replace(suiteName, '').trim() + '</a> (' + getDuration(spec) + ' s)' + printReasonsForFailure(spec) + '</li>';
return template({
mark: marks[spec.status],
name: spec.fullName.replace(suiteName, '').trim(),
reason: printReasonsForFailure(spec),
filename: encodeURIComponent(spec.filename),
duration: getDuration(spec),
});
}

@@ -295,9 +346,3 @@

var reasons = '<ul>';
_.each(spec.failedExpectations, function(exp) {
reasons += '<li>' + exp.message + '</li>';
});
reasons += '</ul>';
return reasons;
return reasonsTemplate({ reasons: spec.failedExpectations });
}

@@ -304,0 +349,0 @@

{
"name": "protractor-jasmine2-screenshot-reporter",
"version": "0.1.6",
"version": "0.1.7",
"description": "Use the screenshot reporter to capture screenshots after each executed Protractor test case.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc