New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(waitFor): replaced page.waitFor by its successor page.waitForTimeout #1277
Conversation
waitFor is deprecated and will be removed in a future release. See puppeteer/puppeteer#6214 for details and how to migrate your code.
Thank you! |
@garris, @mfranzke IMHO this MR will introduce problems with most existing BackstopJS configurations. In order to ensure BC with the current configuration API, the deprecated |
Yes -- I agree with the sentiment here. Thanks all for taking the closer look. Are you all sure there is no 1:1 waitFor replacement currently? It sounds like we will simply be recreating it. Since there will still be backstop implementations using waitFor we should probably revert this last change and just overload puppeteer waitFor with this new helper? Please feel free to propose code changes. Thank you! |
@garris I think that this comment out of the puppeteer ticket that @gruberro mentioned sums it up:
So regarding your summary, I think you're exactly right:
We would be recreating a method, that has been provided by puppeteer previously, which have decided that the user should call the more explicit After reading through the mentioned (and the original) ticket, they state their approach quite clearly - probably it was too late when I did that in the first place to understand the necessary actions and follow them accurately, sorry for that.
Everything out of my summary might have been already clear to everyone else, but I wanted to answer your question @garris as well as provide a list of the necessary tasks (especially regarding documentation) so that we're all on the same page. |
tldr:
Do you really think it is necessary to provide a fallback? I think this is extra effort due to implementation & maintainance and potentially error prone. Puppeteer already provides a deprecation message to (backstopjs) users which is sufficient IMO.
|
...Speaking of puppeteer upgrades https://github.com/puppeteer/puppeteer/releases (2 major releases within 24h 🤔)
|
@@ -7,31 +7,31 @@ module.exports = async (page, scenario) => { | |||
|
|||
if (keyPressSelector) { | |||
for (const keyPressSelectorItem of [].concat(keyPressSelector)) { | |||
await page.waitFor(keyPressSelectorItem.selector); | |||
await page.waitForTimeout(keyPressSelectorItem.selector); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should page.waitForSelector
be used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That indeed not backward compatible, if someone is using an xpath expression rather then a CSS selector, this previously worked. But would no longer work afterwards.
Thank you for all your mentions, all of them are valid. In the end we have to distinguish two approaches: Backward compatible changeSince BackstopJS users today are allowed to use a CSS selector, an xPath expression or a function for all different configuration options available (e.g. Backward incompatible changeIf you prefer a solution without magic behind the scenes, a more cleaner approach could be to stick each BackstopJS configuration option to a dedicated Puppeteer call (e.g. Both of them are valid and technically possible. In the end you @garris should decide which approach is the one to go 😃. There is - for sure - one remaining option (but for sure not the best one): we try to do our best to ignore the noisy deprecation warnings while running tests 🙈 and take care of the problem once |
Thanks for elobarating further on this @gruberro As puppeteer is the underlaying technology to control the browsers, I favor a solution leaning on puppeteer rather than customized, non "standard" (non puppeteer) APIs. Keeping up to date with puppeteer should be the way to go. Keeping it backwards compatible for backstopjs users is ofcourse an argument. If a "fallback layer" is implemented, I'd recommend to make it pluggable and offer it only for one major version and then remove it for the next one. But then again - is it worth the effort? |
@fuhlig I think you have expressed the right way to think about it. In the past we've done some things to help bridge gaps when there are breaking changes in dependencies -- but you're right -- it rarely eliminates pain. The least effort for backstop in this case is to just revert the last change and allow devs to upgrade at their own pace. If someone still wants to build a shim as an engine script to add back the syntactic sugar then I'd be happy to link to their GitHub or blog post -- this is a harmless way to enable most devs and to avoid the divergence liability. |
Created a PR to upgrade puppeteer #1284 |
Fixes #1276