Skip to content

Commit

Permalink
Change puppeteer's waitForTimeout into direct setTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-siola committed Feb 27, 2024
1 parent 275daad commit 19708f8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion capture/engine_scripts/puppet/clickAndHoverHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ module.exports = async (page, scenario) => {
}

if (postInteractionWait) {
await page.waitForTimeout(postInteractionWait);
await new Promise(resolve => {
setTimeout(resolve, postInteractionWait);
});
}

if (scrollToSelector) {
Expand Down
4 changes: 3 additions & 1 deletion core/util/runPuppet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ module.exports = async (page, scenario) => {
}

if (postInteractionWait) {
await page.waitForTimeout(postInteractionWait);
await new Promise(resolve => {
setTimeout(resolve, postInteractionWait);
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ module.exports = async (page, scenario) => {
}

if (postInteractionWait) {
await page.waitForTimeout(postInteractionWait);
await new Promise(resolve => {
setTimeout(resolve, postInteractionWait);
});
}

if (scrollToSelector) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ module.exports = async (page, scenario) => {
}

if (postInteractionWait) {
await page.waitForTimeout(postInteractionWait);
await new Promise(resolve => {
setTimeout(resolve, postInteractionWait);
});
}

if (scrollToSelector) {
Expand Down

0 comments on commit 19708f8

Please sign in to comment.