garris / BackstopJS

Catch CSS curve balls.
http://backstopjs.org
MIT License
6.77k stars 603 forks source link

Backstop hangs on last scenario when using "readyEvent" #1208

Open cvolpe13 opened 4 years ago

cvolpe13 commented 4 years ago

We've got a static Gatsby site running and we're using backstop for visual regression. For the most part it has been working pretty well for us.

One thing I wanted to improve is the hard coded delays that are in place via use of the readyEvent and so we implemented a console log accordingly. The problem that I have and cannot figure out is backstop appears to hang indefinitely when using readyEvent. At first I thought it would hang in random spots but then realized it was also hanging on the very last scenario as defined in the backstop.json file.

Things I've tried:

Has anyone else experienced this, looking for some insight.

Thanks

garris commented 4 years ago

One common issue here happens when a console event fires prior to backstop initializing in your app. This is probably what is happening. Potentially, instead of using the console you can use readySelector. If you need an arbitrary event you can put a noop class on your body that backstop would wait for.

cvolpe-ecobee commented 4 years ago

Thanks @garris. So it sounds like I should forgo using readyEvent. I'll try with readySelector and see how it goes. We're not too keen on the idea of a noop class, but going to see if this may work for us.

Thank you

masi commented 4 years ago

I had some issues with readyEvent and started to look for workarounds. One solution was to hack a timeout into BackstopJS so that a failing test would block the suite which is a PITA with automated testing. The other approach was to try a custom readyProperty within onBefore. The idea is to wait for a global JS-Variable being set by the page's code.

raDiesle commented 3 years ago

Here i have the same issue that after last scenario will finish when using any readyEvent will not stop process.

cvolpe13 commented 3 years ago

Here i have the same issue that after last scenario will finish when using any readyEvent will not stop process.

Ya, readyEvent is still a no go for me. I'm still stuck on using a hard coded wait. @garris Anymore thoughts/ideas on this?

masi commented 3 years ago

I fear we have to patch Backstop and hope that Garris approves our patch. But with 53 pull requests waiting I have no hope. Too bad Backstop is a one person project.

garris commented 3 years ago

Its ordinary to wait for a class or other DOM state using the regular backstop config. And if you really need something custom you can add it to the onReady script without any need to post a PR. This is no different from using vanilla puppeteer or selenium.

Maybe you can prototype your scenario in puppeteer to arrive at a convention you prefer and then use that pattern in your onReady script.

raDiesle commented 3 years ago

Hi @garris , I guess the request is about to let it timeout in some time and to log something to console whats going on

garris commented 3 years ago

Sorry @raDiesle -- it is hard for me to understand the issue here.

klodoma commented 3 years ago

I've just tried out readyEvent and I have the same issue ...

klodoma commented 3 years ago

I've just created a PR to fix the hanging; any idea who can release it?

cvolpe13 commented 3 years ago

@klodoma Nice! Looking forward to testing this out.

klodoma commented 2 years ago

We can close this one: https://github.com/garris/BackstopJS/pull/1338