synpress icon indicating copy to clipboard operation
synpress copied to clipboard

Type error in @synthetixio/synpress/commands/puppeteer.js l.100

Open louis-md opened this issue 3 years ago • 0 comments

Hello,

First, congrats for this great project. By trying to increase puppeteer's timeout for confirming transactions, I found what seems like a type error in file /commands/puppeteer.js line 101: https://github.com/Synthetixio/synpress/blob/debf2c6b635bb40bfc822165707ee1b8c8224c3b/commands/puppeteer.js#L101

The problem comes from the fact that page.waitForFunction does not take a visible parameter, but only timeout and polling (https://puppeteer.github.io/puppeteer/docs/puppeteer.page.waitforfunction/#parameters). It could be useful to either remove it, or use this function to pass a parameter to set puppeteer's timeout when confirming Metamask transactions. To do so, (which I originally came for), I simply replaced this line as follows, and it worked perfectly:

await page.waitForFunction(
      `document.querySelector('${selector}') && document.querySelector('${selector}').clientHeight != 0`,
-      { visible: true },
+      { timeout: 120000 }
    );

I've set the timeout to 120000ms arbitrarily, but it could come from an option in the synpress.json config. Let me know if that makes sense to open a PR on that.

Thanks!

louis-md avatar May 23 '22 17:05 louis-md