BackstopJS
BackstopJS copied to clipboard
Global hideSelectors
So it seems that per scenario you can add
"hideSelectors": ["div[data-autoid='station_clock']", "button[data-autoid='status_button']"]
but this means i have to duplicate this line on every test, is there a way that I can set this globally for each test similar to onBeforeScript.
Yes, you can do this easily in an onReady script. See puppeteer docs for more info.
Why do we have to write the code and do it manually when it is done automatically for us if we put it in a scenario? shouldn't it be possible to check the global stuff before you take the screenshot?
Just had the same issue and had to copy-paste the hideSelectors list into each scenario, while I always need to have certain elements hidden / invisible. Typical examples are Cookie Banners, Slideshows, Chats, ...
+1 to allow defining
- hide
- removeSelectors
also globally and applying them on all scenarios. I guess this is a quite typical use-case. :)
Thanks a lot!
I created a general feature request for this: https://github.com/garris/BackstopJS/issues/1432 So perhaps this particular issue can be closed and people could vote on the general issue?