protractor-beautiful-reporter
Advanced tools
Comparing version 1.2.10 to 1.3.0
@@ -70,2 +70,5 @@ const fs = require('fs'); | ||
//copy templates | ||
fs.copyFileSync(path.join(__dirname, 'lib', 'pbr-screenshot-modal.html'), path.join(basePath,'pbr-screenshot-modal.html')); | ||
fs.copyFileSync(path.join(__dirname, 'lib', 'pbr-stack-modal.html'), path.join(basePath,'pbr-stack-modal.html')); | ||
@@ -72,0 +75,0 @@ // Construct index.html |
# Changelog | ||
## Version 1.3.0 | ||
* Fixed: Navigation in screenshot dialog jumped to non-existing images | ||
* Added: Keyboard navigation in screenshot dialog with left/right arrow keys | ||
* Added: Specific css class for report columns | ||
* Changed: Screenshot dialogs bigger for bigger screens (added css media queries) | ||
## Version 1.2.10 | ||
@@ -4,0 +9,0 @@ * Added option for disabling all screenshots |
@@ -36,3 +36,3 @@ const fs = require('fs'); | ||
keepAlive: true, | ||
configFile: "protractor.jasmine2.conf.js" | ||
configFile: "protractor.jasmine2-useajax.conf.js" | ||
}, | ||
@@ -39,0 +39,0 @@ singlerun: {}, |
@@ -21,3 +21,3 @@ { | ||
"protractor": "^5.1.1", | ||
"protractor-beautiful-reporter": "^1.2.9", | ||
"protractor-beautiful-reporter": "^1.2.10", | ||
"selenium-webdriver": "^3.4.0", | ||
@@ -24,0 +24,0 @@ "webdriver-manager": "^12.0.6" |
@@ -43,2 +43,6 @@ var PageObject = require('./PageObject.js'); | ||
it('should fail because we check for wrong text for demonstration', function () { | ||
expect(page.todoList.get(1).getText()).toEqual('Does not match'); | ||
}); | ||
it('should add a todo', function () { | ||
@@ -95,3 +99,3 @@ page.addTodo.sendKeys('write a protractor test'); | ||
it('level 4 it nr 1', function () { | ||
browser.executeScript("console.warn('Warn nexted deepply spec level4 test!');"); | ||
}); | ||
@@ -98,0 +102,0 @@ it('level 4 it nr 2', function () { |
231
lib/app.js
@@ -50,7 +50,33 @@ var app = angular.module('reportingApp', []); | ||
var convertTimestamp = function (timestamp) { | ||
var d = new Date(timestamp), | ||
yyyy = d.getFullYear(), | ||
mm = ('0' + (d.getMonth() + 1)).slice(-2), | ||
dd = ('0' + d.getDate()).slice(-2), | ||
hh = d.getHours(), | ||
h = hh, | ||
min = ('0' + d.getMinutes()).slice(-2), | ||
ampm = 'AM', | ||
time; | ||
if (hh > 12) { | ||
h = hh - 12; | ||
ampm = 'PM'; | ||
} else if (hh === 12) { | ||
h = 12; | ||
ampm = 'PM'; | ||
} else if (hh === 0) { | ||
h = 12; | ||
} | ||
// ie: 2013-02-18, 8:35 AM | ||
time = yyyy + '-' + mm + '-' + dd + ', ' + h + ':' + min + ' ' + ampm; | ||
return time; | ||
}; | ||
var defaultSortFunction = function sortFunction(a, b) { | ||
if (a.sessionId < b.sessionId) { | ||
return -1; | ||
} | ||
else if (a.sessionId > b.sessionId) { | ||
} else if (a.sessionId > b.sessionId) { | ||
return 1; | ||
@@ -61,4 +87,3 @@ } | ||
return -1; | ||
} | ||
else if (a.timestamp > b.timestamp) { | ||
} else if (a.timestamp > b.timestamp) { | ||
return 1; | ||
@@ -70,6 +95,5 @@ } | ||
//</editor-fold> | ||
app.controller('ScreenshotReportController', function ($scope, $http) { | ||
app.controller('ScreenshotReportController', ['$scope', '$http', 'TitleService', function ($scope, $http, titleService) { | ||
var that = this; | ||
@@ -113,3 +137,3 @@ var clientDefaults = {};//'<Client Defaults Replacement>'; | ||
} | ||
if (initialColumnSettings.dangerTime){ | ||
if (initialColumnSettings.dangerTime) { | ||
this.dangerTime = initialColumnSettings.dangerTime; | ||
@@ -119,3 +143,2 @@ } | ||
this.showSmartStackTraceHighlight = true; | ||
@@ -150,31 +173,40 @@ this.chooseAllTypes = function () { | ||
}; | ||
this.hasNextScreenshot = function (index) { | ||
var old = index; | ||
return old !== this.getNextScreenshotIdx(index); | ||
}; | ||
this.convertTimestamp = function (timestamp) { | ||
var d = new Date(timestamp), | ||
yyyy = d.getFullYear(), | ||
mm = ('0' + (d.getMonth() + 1)).slice(-2), | ||
dd = ('0' + d.getDate()).slice(-2), | ||
hh = d.getHours(), | ||
h = hh, | ||
min = ('0' + d.getMinutes()).slice(-2), | ||
ampm = 'AM', | ||
time; | ||
this.hasPreviousScreenshot = function (index) { | ||
var old = index; | ||
return old !== this.getPreviousScreenshotIdx(index); | ||
}; | ||
this.getNextScreenshotIdx = function (index) { | ||
var next = index; | ||
var hit = false; | ||
while (next + 2 < this.results.length) { | ||
next++; | ||
if (this.results[next].screenShotFile && !this.results[next].pending) { | ||
hit = true; | ||
break; | ||
} | ||
} | ||
return hit ? next : index; | ||
}; | ||
if (hh > 12) { | ||
h = hh - 12; | ||
ampm = 'PM'; | ||
} else if (hh === 12) { | ||
h = 12; | ||
ampm = 'PM'; | ||
} else if (hh === 0) { | ||
h = 12; | ||
this.getPreviousScreenshotIdx = function (index) { | ||
var prev = index; | ||
var hit = false; | ||
while (prev > 0) { | ||
prev--; | ||
if (this.results[prev].screenShotFile && !this.results[prev].pending) { | ||
hit = true; | ||
break; | ||
} | ||
} | ||
return hit ? prev : index; | ||
}; | ||
// ie: 2013-02-18, 8:35 AM | ||
time = yyyy + '-' + mm + '-' + dd + ', ' + h + ':' + min + ' ' + ampm; | ||
this.convertTimestamp = convertTimestamp; | ||
return time; | ||
}; | ||
this.round = function (number, roundVal) { | ||
@@ -233,16 +265,2 @@ return (parseFloat(number) / 1000).toFixed(roundVal); | ||
this.applySmartHighlight = function (line) { | ||
if (this.showSmartStackTraceHighlight) { | ||
if (line.indexOf('node_modules') > -1) { | ||
return 'greyout'; | ||
} | ||
if (line.indexOf(' at ') === -1) { | ||
return ''; | ||
} | ||
return 'highlight'; | ||
} | ||
return true; | ||
}; | ||
var results = [];//'<Results Replacement>'; | ||
@@ -252,4 +270,17 @@ | ||
this.results = results.sort(defaultSortFunction/*<Sort Function Replacement>*/); | ||
}; | ||
this.setTitle = function () { | ||
var title = $('.report-title').text(); | ||
titleService.setTitle(title); | ||
}; | ||
// is run after all test data has been prepared/loaded | ||
this.afterLoadingJobs = function () { | ||
this.sortSpecs(); | ||
this.setTitle(); | ||
}; | ||
this.loadResultsViaAjax = function () { | ||
@@ -267,4 +298,3 @@ | ||
data = CircularJSON.parse(response.data); //the file is escaped in a weird way (with circular json) | ||
} | ||
else { | ||
} else { | ||
data = JSON.parse(response.data); | ||
@@ -275,3 +305,3 @@ } | ||
results = data; | ||
that.sortSpecs(); | ||
that.afterLoadingJobs(); | ||
} | ||
@@ -288,8 +318,7 @@ }, | ||
} else { | ||
this.sortSpecs(); | ||
this.afterLoadingJobs(); | ||
} | ||
}]); | ||
}); | ||
app.filter('bySearchSettings', function () { | ||
@@ -334,1 +363,101 @@ return function (items, searchSettings) { | ||
function PbrStackModalController($scope, $rootScope) { | ||
var ctrl = this; | ||
ctrl.rootScope = $rootScope; | ||
ctrl.getParent = getParent; | ||
ctrl.getShortDescription = getShortDescription; | ||
ctrl.convertTimestamp = convertTimestamp; | ||
ctrl.isValueAnArray = isValueAnArray; | ||
ctrl.toggleSmartStackTraceHighlight = function () { | ||
var inv = !ctrl.rootScope.showSmartStackTraceHighlight; | ||
ctrl.rootScope.showSmartStackTraceHighlight = inv; | ||
}; | ||
ctrl.applySmartHighlight = function (line) { | ||
if ($rootScope.showSmartStackTraceHighlight) { | ||
if (line.indexOf('node_modules') > -1) { | ||
return 'greyout'; | ||
} | ||
if (line.indexOf(' at ') === -1) { | ||
return ''; | ||
} | ||
return 'highlight'; | ||
} | ||
return ''; | ||
}; | ||
} | ||
app.component('pbrStackModal', { | ||
templateUrl: "pbr-stack-modal.html", | ||
bindings: { | ||
index: '=', | ||
data: '=' | ||
}, | ||
controller: PbrStackModalController | ||
}); | ||
function PbrScreenshotModalController($scope, $rootScope) { | ||
var ctrl = this; | ||
ctrl.rootScope = $rootScope; | ||
ctrl.getParent = getParent; | ||
ctrl.getShortDescription = getShortDescription; | ||
/** | ||
* Updates which modal is selected. | ||
*/ | ||
this.updateSelectedModal = function (event, index) { | ||
var key = event.key; //try to use non-deprecated key first https://developer.mozilla.org/de/docs/Web/API/KeyboardEvent/keyCode | ||
if (key == null) { | ||
var keyMap = { | ||
37: 'ArrowLeft', | ||
39: 'ArrowRight' | ||
}; | ||
key = keyMap[event.keyCode]; //fallback to keycode | ||
} | ||
if (key === "ArrowLeft" && this.hasPrevious) { | ||
this.showHideModal(index, this.previous); | ||
} else if (key === "ArrowRight" && this.hasNext) { | ||
this.showHideModal(index, this.next); | ||
} | ||
}; | ||
/** | ||
* Hides the modal with the #oldIndex and shows the modal with the #newIndex. | ||
*/ | ||
this.showHideModal = function (oldIndex, newIndex) { | ||
const modalName = '#imageModal'; | ||
$(modalName + oldIndex).modal("hide"); | ||
$(modalName + newIndex).modal("show"); | ||
}; | ||
} | ||
app.component('pbrScreenshotModal', { | ||
templateUrl: "pbr-screenshot-modal.html", | ||
bindings: { | ||
index: '=', | ||
data: '=', | ||
next: '=', | ||
previous: '=', | ||
hasNext: '=', | ||
hasPrevious: '=' | ||
}, | ||
controller: PbrScreenshotModalController | ||
}); | ||
app.factory('TitleService', ['$document', function ($document) { | ||
return { | ||
setTitle: function (title) { | ||
$document[0].title = title; | ||
} | ||
}; | ||
}]); | ||
app.run( | ||
function ($rootScope) { | ||
//make sure this option is on by default | ||
$rootScope.showSmartStackTraceHighlight = true; | ||
}); |
{ | ||
"name": "protractor-beautiful-reporter", | ||
"version": "1.2.10", | ||
"version": "1.3.0", | ||
"description": "An npm module and which generates your Protractor test reports in HTML (angular) with screenshots", | ||
@@ -57,2 +57,3 @@ "main": "index.js", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-cli": "^2.0.0", | ||
"karma-coverage": "^1.1.2", | ||
@@ -62,6 +63,6 @@ "karma-jasmine": "^1.1.2", | ||
"karma-spec-reporter": "0.0.32", | ||
"nodemon": "^1.18.4", | ||
"phantomjs-prebuilt": "^2.1.4", | ||
"nodemon": "^1.18.4", | ||
"webpack": "2.7.0" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
6159640
43
55505
21
24