New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

testarmada-magellan-nightwatch

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testarmada-magellan-nightwatch - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

76

lib/commands/getPerformance.js

@@ -19,6 +19,8 @@ var util = require("util");

var performance = window.performance || window.webkitPerformance || window.mozPerformance || window.msPerformance || {}
// feature check
if (!!performance) {
if (!!performance) {
var timingObj = performance.timing;
var navigationObj = performance.navigation;

@@ -28,43 +30,59 @@ var now = new Date().getTime();

var domContentLoad = timingObj.domContentLoadedEventStart - timingObj.domLoading;
var firstPaint=0;
if (window.chrome && window.chrome.loadTimes) {
firstPaint= window.chrome.loadTimes().firstPaintTime * 1000 - timingObj.navigationStart;
var firstPaint = 0;
if (window.chrome && window.chrome.loadTimes) {
firstPaint = window.chrome.loadTimes().firstPaintTime * 1000 - timingObj.navigationStart;
}
if (typeof window.performance.timing.msFirstPaint === 'number') {
if (typeof window.performance.timing.msFirstPaint === 'number') {
firstPaint = window.performance.timing.msFirstPaint - timingObj.navigationStart;
}
var fullPageLoad = window.performance.timing.loadEventEnd - window.performance.timing.responseEnd;
var dnsLookup = window.performance.timing.domainLookupEnd - window.performance.timing.domainLookupStart;
var domInteractive = window.performance.timing.domInteractive - window.performance.timing.navigationStart;
//TO-DO, sometimes loadEventEnd is coming out to be ZERO, hence displaying the fullPageLoad in negavtive, especially in Chrome
var numOfRequests = window.performance.getEntries().length;
performanceMetrics.push("DomContentLoad: " + domContentLoad / 1000 + ' seconds');
performanceMetrics.push("Page Load (onLoad): " + loadTime / 1000 + ' seconds');
performanceMetrics.push("Full Page Load: " + fullPageLoad / 1000 + ' seconds');
performanceMetrics.push("Number of Requests: " + numOfRequests);
performanceMetrics.push("First Paint: " + firstPaint/1000 + ' seconds');
//get resource times
var resourceList = window.performance.getEntriesByType("resource");
var countImg=0;
for (i = 0; i < resourceList.length; i++) {
if (resourceList[i].initiatorType == "img") {
countImg++;
}
}
if(firstPaint == 0){
firstPaint = "Not available";
}else{
firstPaint = parseFloat(Math.round(firstPaint).toFixed(3)) / 1000 + ' seconds';
}
var redirectCount = navigationObj.redirectCount;
performanceMetrics.push("DNS Lookup: " + dnsLookup / 1000 + ' seconds');
performanceMetrics.push("DomContentLoad: " + domContentLoad / 1000 + ' seconds');
performanceMetrics.push("First Paint: " + firstPaint);
performanceMetrics.push("DomInteractive: " + domInteractive / 1000 + ' seconds');
performanceMetrics.push("Page Load (onLoad): " + loadTime / 1000 + ' seconds');
performanceMetrics.push("Redirect Counts: " + redirectCount);
performanceMetrics.push("Number of Resources: " + resourceList.length);
performanceMetrics.push("Number of Images: " + countImg);
return performanceMetrics;
return performanceMetrics;
} else {
return "Performance API is not supported by this browser or browser version";
}
}else{
return "Performance API is not supported by this browser or browser version";
}
} catch (e) {
return "Couldnt get timing, it is possible that the browser selected does not support performance API. Recieved error : " + e.message;
}
}, [],
function(result) {
cb.call(this, result.value);
console.log('Load Time : ', result.value);
self.emit("complete");
} catch (e) {
return "Couldnt get timing, it is possible that the browser selected does not support performance API. Recieved error : " + e.message;
}
}, [],
function(result) {
cb.call(this, result.value);
console.log('Load Time : ', result.value);
self.emit("complete");
});
});
return this;
return this;
};
module.exports = PerformanceMetrics;
{
"name": "testarmada-magellan-nightwatch",
"version": "1.5.3",
"version": "1.5.4",
"description": "Nightwatch.js adapter for Magellan",

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

@@ -86,2 +86,6 @@ # magellan-nightwatch

<tr>
<td>getPerformance(url)</td>
<td>Retrieves basic performance metrics using Navigation API (http://www.w3.org/TR/navigation-timing/)</td>
</tr>
<tr>
<td>assert.containsText(selector, text)</td>

@@ -242,2 +246,7 @@ <td>assert.elContainsText(selector, regex or text)</td>

### 1.5.2
### 1.5.3
*Added getPerformance command to retrieve the performance results for a url
* Fixed problem with jQuery injection in some assertions.
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc