From 1bc6b846b6ab0b5f1090cc4e8c891a3e249852b2 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 12 Dec 2021 19:40:50 +0100 Subject: [PATCH] Consistently use string arguments for `page.waitForFunction` calls We use string arguments in all other places, so these two places are a bit inconsistent in that sense. Moreover, it's just one argument now, which makes it a bit easier to read and see what it does because we don't have to pass the always-empty options argument anymore. Finally, doing it like this ensures it works in all Puppeteer versions given https://github.com/puppeteer/puppeteer/issues/7836. --- test/integration/scripting_spec.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/test/integration/scripting_spec.js b/test/integration/scripting_spec.js index 43594d577..f78fb81c5 100644 --- a/test/integration/scripting_spec.js +++ b/test/integration/scripting_spec.js @@ -696,14 +696,9 @@ describe("Interaction", () => { ); await page.click(`[data-annotation-id='${id}R']`); + const selector = ref.replace("\\", "\\\\"); await page.waitForFunction( - (_ref, _current, _propName) => - getComputedStyle(document.querySelector(_ref))[_propName] !== - _current, - {}, - ref, - current, - propName + `getComputedStyle(document.querySelector("${selector}"))["${propName}"] !== "${current}"` ); const color = await page.$eval( @@ -755,11 +750,7 @@ describe("Interaction", () => { await page.keyboard.press("Tab"); await page.waitForFunction( - _prev => - getComputedStyle(document.querySelector("#\\31 71R")).value !== - _prev, - {}, - prev + `getComputedStyle(document.querySelector("#\\\\31 71R")).value !== "${prev}"` ); sum += val;