You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for making such a great library available for everyone to use. At our company we're getting a lot of use out of it :)
One feature we need internally is to take a screenshot of a portion of particular stories. Specifically, we render out dom nodes with a data-canvas-strip attribute and we're interested in ensuring that the screenshot only contains that node and nothing else. We don't necessarily know the height of each story ahead of time (it varies between stories and hardcoding is isn't portable across different viewports) so simply cropping the screenshots after taking them isn't feasible.
I've attached a proof of concept diff which adds a selector field which takes a CSS selector to the ScreenshotOptions interface and it works great for us, but we'd like to upstream it if possible so that we don't need to maintain a fork and so that other people can use the feature if they think it's useful.
I'm more than happy to take the diff and improve it so that it can be PRed. I would just need some pointers on the following:
Is my general approach correct? I've added a captureRawScreenshotBuffer method to the CapturingBrowser class which handles the selector option. This was the first place I saw I could add it, so I'm not sure if there's a more appropriate location for it.
If the user provides a selector that doesn't match an element, should that be an error or should we just fall back to capturing the entire viewport? We don't hit this case in our code because we always have a valid selector but of course it could happen to someone using the package.
Is there any need for test cases? The only test I can see is the e2e.sh file which runs storycap and asserts that at least one screenshot file is emitted. If that's the only test currently then I assume this feature doesn't need any additional tests?
Please let me know your thoughts on this and I'll get to work on a proper PR if you're happy to accept one for this feature.
https://github.com/remix/storycap/pull/3/files is a similar way to do things, in which we manually specify the bounding box (which may have its uses, especially when the actual screenshot-taking code is wrapped in one's own layer anyways)
Thanks for making such a great library available for everyone to use. At our company we're getting a lot of use out of it :)
One feature we need internally is to take a screenshot of a portion of particular stories. Specifically, we render out dom nodes with a
data-canvas-strip
attribute and we're interested in ensuring that the screenshot only contains that node and nothing else. We don't necessarily know the height of each story ahead of time (it varies between stories and hardcoding is isn't portable across different viewports) so simply cropping the screenshots after taking them isn't feasible.I've attached a proof of concept diff which adds a
selector
field which takes a CSS selector to theScreenshotOptions
interface and it works great for us, but we'd like to upstream it if possible so that we don't need to maintain a fork and so that other people can use the feature if they think it's useful.I'm more than happy to take the diff and improve it so that it can be PRed. I would just need some pointers on the following:
captureRawScreenshotBuffer
method to theCapturingBrowser
class which handles theselector
option. This was the first place I saw I could add it, so I'm not sure if there's a more appropriate location for it.e2e.sh
file which runs storycap and asserts that at least one screenshot file is emitted. If that's the only test currently then I assume this feature doesn't need any additional tests?Please let me know your thoughts on this and I'll get to work on a proper PR if you're happy to accept one for this feature.
Current patch:
The text was updated successfully, but these errors were encountered: