From 19708f8d24366091dfae6b837362fb9659a68df7 Mon Sep 17 00:00:00 2001 From: maciej-siola Date: Tue, 27 Feb 2024 14:00:34 +0100 Subject: [PATCH] Change puppeteer's waitForTimeout into direct setTimeout --- capture/engine_scripts/puppet/clickAndHoverHelper.js | 4 +++- core/util/runPuppet.js | 4 +++- .../engine_scripts/puppet/clickAndHoverHelper.js | 4 +++- .../engine_scripts/puppet/clickAndHoverHelper.js | 4 +++- .../engine_scripts/puppet/clickAndHoverHelper.js | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/capture/engine_scripts/puppet/clickAndHoverHelper.js b/capture/engine_scripts/puppet/clickAndHoverHelper.js index d848fcfe4..703d3b89b 100644 --- a/capture/engine_scripts/puppet/clickAndHoverHelper.js +++ b/capture/engine_scripts/puppet/clickAndHoverHelper.js @@ -27,7 +27,9 @@ module.exports = async (page, scenario) => { } if (postInteractionWait) { - await page.waitForTimeout(postInteractionWait); + await new Promise(resolve => { + setTimeout(resolve, postInteractionWait); + }); } if (scrollToSelector) { diff --git a/core/util/runPuppet.js b/core/util/runPuppet.js index 5b3c7491f..5c5ef7f87 100644 --- a/core/util/runPuppet.js +++ b/core/util/runPuppet.js @@ -175,7 +175,9 @@ async function processScenarioView (scenario, variantOrScenarioLabelSafe, scenar // --- DELAY --- if (scenario.delay > 0) { - await page.waitForTimeout(scenario.delay); + await new Promise(resolve => { + setTimeout(resolve, scenario.delay); + }); } // --- REMOVE SELECTORS --- diff --git a/examples/Jenkins/Sample/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js b/examples/Jenkins/Sample/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js index 75e7bf287..14c193009 100644 --- a/examples/Jenkins/Sample/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js +++ b/examples/Jenkins/Sample/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js @@ -14,6 +14,8 @@ module.exports = async (page, scenario) => { } if (postInteractionWait) { - await page.waitForTimeout(postInteractionWait); + await new Promise(resolve => { + setTimeout(resolve, postInteractionWait); + }); } }; diff --git a/examples/responsiveDemo/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js b/examples/responsiveDemo/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js index f89824e02..3a2a3aa73 100644 --- a/examples/responsiveDemo/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js +++ b/examples/responsiveDemo/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js @@ -19,7 +19,9 @@ module.exports = async (page, scenario) => { } if (postInteractionWait) { - await page.waitForTimeout(postInteractionWait); + await new Promise(resolve => { + setTimeout(resolve, postInteractionWait); + }); } if (scrollToSelector) { diff --git a/test/configs/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js b/test/configs/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js index 670daa098..ff79379fa 100644 --- a/test/configs/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js +++ b/test/configs/backstop_data/engine_scripts/puppet/clickAndHoverHelper.js @@ -23,7 +23,9 @@ module.exports = async (page, scenario) => { } if (postInteractionWait) { - await page.waitForTimeout(postInteractionWait); + await new Promise(resolve => { + setTimeout(resolve, postInteractionWait); + }); } if (scrollToSelector) {