insomnia-plugin-load-test-timing
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -1,6 +0,1 @@ | ||
const { | ||
remote: { BrowserWindow, getCurrentWindow }, | ||
} = require("electron"); | ||
const ProgressBar = require("electron-progressbar"); | ||
const css = ` | ||
@@ -41,26 +36,5 @@ header { padding-bottom: 20px; text-align: center; } | ||
const createProgressBar = (maxValue) => | ||
new ProgressBar({ | ||
text: "Preparing data...", | ||
detail: "Please Wait...", | ||
indeterminate: false, | ||
maxValue, | ||
remoteWindow: BrowserWindow, | ||
browserWindow: { | ||
parent: getCurrentWindow(), | ||
modal: false, | ||
closable: true, | ||
indeterminate: false, | ||
}, | ||
}); | ||
const createResultWindow = () => | ||
new BrowserWindow({ | ||
autoHideMenuBar: true, | ||
show: false, | ||
}); | ||
const action = async (context, data) => { | ||
const { requests } = data; | ||
let progress = null; | ||
const progressModal = document.createElement('div'); | ||
let abortRequests = false; | ||
@@ -121,3 +95,3 @@ let numIterations, delayBetweenRequests, runInParallel; | ||
<header> | ||
<b># Iterations:</b> [${numIterations}] <b>Delay between requests:</b> [${delayBetweenRequests}s] <b>Run:</b> | ||
<b># Iterations:</b> [${numIterations}] <b>Delay between requests:</b> [${delayBetweenRequests}ms] <b>Run:</b> | ||
[${runInParallel ? "in Parallel" : "Serially"}] | ||
@@ -137,3 +111,2 @@ </header>`; | ||
responses.forEach((response, i) => { | ||
progress.value += 1; | ||
const result = results[j || i]; | ||
@@ -154,6 +127,12 @@ if (response.statusCode.toString().startsWith("2")) { | ||
const execute = () => { | ||
progress = createProgressBar(requests.length * numIterations); | ||
progress.on("aborted", function () { | ||
console.info(`aborted...`); | ||
abortRequests = true; | ||
progressModal.style.padding = '20px'; | ||
progressModal.innerHTML = ` | ||
<h4><font color=red><strong>If you close this, requests will be aborted</strong></font></h4> | ||
<p>Please wait until all requests finishes. Due to the limitations of the Insomnia Plugins we can not show you a progress bar | ||
but you can always open the DevTools and see the console.</p>`; | ||
context.app.dialog("Processing", progressModal, { | ||
onHide: () => { | ||
console.info(`aborted...`); | ||
abortRequests = true; | ||
} | ||
}); | ||
@@ -226,6 +205,7 @@ return new Promise((resolve, reject) => { | ||
const html = startHtml + header + startTableHtml + rows.join("") + endHtml; | ||
const content = "data:text/html;charset=UTF-8," + encodeURIComponent(html); | ||
const resultWindow = createResultWindow(); | ||
resultWindow.loadURL(content); | ||
resultWindow.show(); | ||
progressModal.innerHTML = html; | ||
context.app.dialog("Results Table", progressModal, { | ||
tall: true, | ||
}); | ||
} catch (err) { | ||
@@ -232,0 +212,0 @@ if (!abortRequests) { |
{ | ||
"name": "insomnia-plugin-load-test-timing", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"main": "load-test-timing.js", | ||
@@ -9,5 +9,2 @@ "insomnia": { | ||
}, | ||
"dependencies": { | ||
"electron-progressbar": "2.0.0" | ||
}, | ||
"description": "This plugin adds an option to each folder's drop-down menu that allows you to run all the requests in the folder and gather timing information.", | ||
@@ -14,0 +11,0 @@ "scripts": { |
0
75450
194
- Removedelectron-progressbar@2.0.0
- Removedelectron-progressbar@2.0.0(transitive)
- Removedextend@3.0.2(transitive)