BackstopJS icon indicating copy to clipboard operation
BackstopJS copied to clipboard

Backstop hangs on last scenario when using "readyEvent"

Open cvolpe13 opened this issue 5 years ago • 13 comments

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:

  • Running with and without docker
  • Running with an async capture and compare limit of 1 but this didn't help (it would still hang)
  • Running a single scenario works fine with readyEvent

Has anyone else experienced this, looking for some insight.

Thanks

cvolpe13 avatar Jul 13 '20 17:07 cvolpe13

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.

garris avatar Jul 13 '20 19:07 garris

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

cvolpe-ecobee avatar Jul 14 '20 19:07 cvolpe-ecobee

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.

masi avatar Sep 14 '20 10:09 masi

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

raDiesle avatar Dec 04 '20 14:12 raDiesle

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?

cvolpe13 avatar Dec 04 '20 15:12 cvolpe13

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.

masi avatar Dec 04 '20 17:12 masi

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.

garris avatar Dec 05 '20 05:12 garris

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

raDiesle avatar Dec 05 '20 09:12 raDiesle

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

garris avatar Dec 05 '20 16:12 garris

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

klodoma avatar Jun 21 '21 14:06 klodoma

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

klodoma avatar Jul 08 '21 15:07 klodoma

@klodoma Nice! Looking forward to testing this out.

cvolpe13 avatar Jul 08 '21 16:07 cvolpe13

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

klodoma avatar Sep 05 '22 11:09 klodoma