From ed1178d868bf4d45efeeceb4d34fe1f9af5c6289 Mon Sep 17 00:00:00 2001 From: Siddhant Shukla <70441430+Siddhantshukla814@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:51:14 +0530 Subject: [PATCH 1/5] initial commit --- lib/webpagetest.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/webpagetest.js b/lib/webpagetest.js index c593336..00b0702 100644 --- a/lib/webpagetest.js +++ b/lib/webpagetest.js @@ -474,7 +474,9 @@ function runTest(what, options, callback) { // poll results if (options.pollResults && !options.dryRun) { - options.pollResults = parseInt(options.pollResults * 1000, 10) || 5000; + // setting the lower limit to 20s + options.pollResults = Math.max(20, options.pollResults) * 1000; + options.pollResults = parseInt(options.pollResults, 10) || 60000; return api.call( this, @@ -537,7 +539,7 @@ function runTest(what, options, callback) { function runTestAndWait(what, options, callback) { delete options.pollResults; - options = Object.assign(options, { pollResults: 13 }); + options = Object.assign(options, { pollResults: 60 }); new Promise((resolve) => { let test = runTest.bind(this, what, options, callback); From 5c6733a5e22ac77f286d404c83dfe4d59517edb0 Mon Sep 17 00:00:00 2001 From: Siddhant Shukla <70441430+Siddhantshukla814@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:54:03 +0530 Subject: [PATCH 2/5] const file --- lib/consts.js | 1 + lib/webpagetest.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 lib/consts.js diff --git a/lib/consts.js b/lib/consts.js new file mode 100644 index 0000000..35f4135 --- /dev/null +++ b/lib/consts.js @@ -0,0 +1 @@ +export const DEFAULT_POLL_VALUE = 60; diff --git a/lib/webpagetest.js b/lib/webpagetest.js index 00b0702..4ad01c0 100644 --- a/lib/webpagetest.js +++ b/lib/webpagetest.js @@ -15,6 +15,8 @@ var http = require("http"), server = require("./server"), mapping = require("./mapping"); +const { DEFAULT_POLL_VALUE } = require("./consts"); + var reSpace = /\s/, reConnectivity = /^(?:Cable|DSL|3GSlow|3G|3GFast|4G|LTE|Edge|2G|Dial|FIOS|Native|custom)$/, @@ -475,8 +477,7 @@ function runTest(what, options, callback) { // poll results if (options.pollResults && !options.dryRun) { // setting the lower limit to 20s - options.pollResults = Math.max(20, options.pollResults) * 1000; - options.pollResults = parseInt(options.pollResults, 10) || 60000; + options.pollResults = Math.max(20, options.pollResults || DEFAULT_POLL_VALUE) * 1000; return api.call( this, @@ -539,7 +540,7 @@ function runTest(what, options, callback) { function runTestAndWait(what, options, callback) { delete options.pollResults; - options = Object.assign(options, { pollResults: 60 }); + options = Object.assign(options, { pollResults: DEFAULT_POLL_VALUE }); new Promise((resolve) => { let test = runTest.bind(this, what, options, callback); From 1a5ca454bfb5915811c43d5752665354513db7e8 Mon Sep 17 00:00:00 2001 From: Siddhant Shukla <70441430+Siddhantshukla814@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:56:45 +0530 Subject: [PATCH 3/5] lower limit variable --- lib/consts.js | 1 + lib/webpagetest.js | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/consts.js b/lib/consts.js index 35f4135..7fb8afa 100644 --- a/lib/consts.js +++ b/lib/consts.js @@ -1 +1,2 @@ export const DEFAULT_POLL_VALUE = 60; +export const POLL_LOWER_LIMIT = 20; diff --git a/lib/webpagetest.js b/lib/webpagetest.js index 4ad01c0..92f3427 100644 --- a/lib/webpagetest.js +++ b/lib/webpagetest.js @@ -15,7 +15,7 @@ var http = require("http"), server = require("./server"), mapping = require("./mapping"); -const { DEFAULT_POLL_VALUE } = require("./consts"); +const { DEFAULT_POLL_VALUE, POLL_LOWER_LIMIT} = require("./consts"); var reSpace = /\s/, reConnectivity = @@ -476,8 +476,7 @@ function runTest(what, options, callback) { // poll results if (options.pollResults && !options.dryRun) { - // setting the lower limit to 20s - options.pollResults = Math.max(20, options.pollResults || DEFAULT_POLL_VALUE) * 1000; + options.pollResults = Math.max(POLL_LOWER_LIMIT, options.pollResults || DEFAULT_POLL_VALUE) * 1000; return api.call( this, From ae6971ef0bc2162cefc32caaedd662cb6dc44338 Mon Sep 17 00:00:00 2001 From: Siddhant Shukla <70441430+Siddhantshukla814@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:52:41 +0530 Subject: [PATCH 4/5] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 68daa4b..40a360c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpagetest", - "version": "0.7.5", + "version": "0.7.6", "description": "WebPageTest API wrapper for NodeJS", "author": "WebPageTest (http://github.com/WebPageTest)", "homepage": "http://github.com/WebPageTest/webpagetest-api", From e7cf63d78af49ecd1afe22fb11f61593e0677636 Mon Sep 17 00:00:00 2001 From: Siddhant Shukla Date: Tue, 19 Nov 2024 12:43:17 +0530 Subject: [PATCH 5/5] export fix --- lib/consts.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/consts.js b/lib/consts.js index 7fb8afa..1a6573f 100644 --- a/lib/consts.js +++ b/lib/consts.js @@ -1,2 +1,7 @@ -export const DEFAULT_POLL_VALUE = 60; -export const POLL_LOWER_LIMIT = 20; +const DEFAULT_POLL_VALUE = 60; +const POLL_LOWER_LIMIT = 20; + +module.exports = { + DEFAULT_POLL_VALUE, + POLL_LOWER_LIMIT +}; \ No newline at end of file