Skip to content

Commit

Permalink
Remove usage of deprecated/removed waitFor in clickAndHoverHelper scr…
Browse files Browse the repository at this point in the history
…ipts (fixes garris#1431) (garris#1441)
  • Loading branch information
flosell authored Oct 9, 2022
1 parent f27ec8f commit 1018f68
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions capture/engine_scripts/puppet/clickAndHoverHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ module.exports = async (page, scenario) => {

if (keyPressSelector) {
for (const keyPressSelectorItem of [].concat(keyPressSelector)) {
await page.waitFor(keyPressSelectorItem.selector);
await page.waitForSelector(keyPressSelectorItem.selector);
await page.type(keyPressSelectorItem.selector, keyPressSelectorItem.keyPress);
}
}

if (hoverSelector) {
for (const hoverSelectorIndex of [].concat(hoverSelector)) {
await page.waitFor(hoverSelectorIndex);
await page.waitForSelector(hoverSelectorIndex);
await page.hover(hoverSelectorIndex);
}
}

if (clickSelector) {
for (const clickSelectorIndex of [].concat(clickSelector)) {
await page.waitFor(clickSelectorIndex);
await page.waitForSelector(clickSelectorIndex);
await page.click(clickSelectorIndex);
}
}

if (postInteractionWait) {
await page.waitFor(postInteractionWait);
await page.waitForTimeout(postInteractionWait);
}

if (scrollToSelector) {
await page.waitFor(scrollToSelector);
await page.waitForSelector(scrollToSelector);
await page.evaluate(scrollToSelector => {
document.querySelector(scrollToSelector).scrollIntoView();
}, scrollToSelector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ module.exports = async (page, scenario) => {
const postInteractionWait = scenario.postInteractionWait; // selector [str] | ms [int]

if (hoverSelector) {
await page.waitFor(hoverSelector);
await page.waitForSelector(hoverSelector);
await page.hover(hoverSelector);
}

if (clickSelector) {
await page.waitFor(clickSelector);
await page.waitForSelector(clickSelector);
await page.click(clickSelector);
}

if (postInteractionWait) {
await page.waitFor(postInteractionWait);
await page.waitForTimeout(postInteractionWait);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ module.exports = async (page, scenario) => {

if (hoverSelector) {
for (const hoverSelectorIndex of [].concat(hoverSelector)) {
await page.waitFor(hoverSelectorIndex);
await page.waitForSelector(hoverSelectorIndex);
await page.hover(hoverSelectorIndex);
}
}

if (clickSelector) {
for (const clickSelectorIndex of [].concat(clickSelector)) {
await page.waitFor(clickSelectorIndex);
await page.waitForSelector(clickSelectorIndex);
await page.click(clickSelectorIndex);
}
}

if (postInteractionWait) {
await page.waitFor(postInteractionWait);
await page.waitForTimeout(postInteractionWait);
}

if (scrollToSelector) {
await page.waitFor(scrollToSelector);
await page.waitForSelector(scrollToSelector);
await page.evaluate(scrollToSelector => {
document.querySelector(scrollToSelector).scrollIntoView();
}, scrollToSelector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ module.exports = async (page, scenario) => {

if (keyPressSelector) {
for (const keyPressSelectorItem of [].concat(keyPressSelector)) {
await page.waitFor(keyPressSelectorItem.selector);
await page.waitForSelector(keyPressSelectorItem.selector);
await page.type(keyPressSelectorItem.selector, keyPressSelectorItem.keyPress);
}
}

if (hoverSelector) {
await page.waitFor(hoverSelector);
await page.waitForSelector(hoverSelector);
await page.hover(hoverSelector);
}

if (clickSelector) {
await page.waitFor(clickSelector);
await page.waitForSelector(clickSelector);
await page.click(clickSelector);
}

if (postInteractionWait) {
await page.waitFor(postInteractionWait);
await page.waitForTimeout(postInteractionWait);
}

if (scrollToSelector) {
await page.waitFor(scrollToSelector);
await page.waitForSelector(scrollToSelector);
await page.evaluate(scrollToSelector => {
document.querySelector(scrollToSelector).scrollIntoView();
}, scrollToSelector);
Expand Down

0 comments on commit 1018f68

Please sign in to comment.